Here in this article, you will find the important Linux commands you should know in the Linux Operating System
What is Linux?
The first thing that we need to talk about in this article is the origins of Linux. In a nutshell, Linux is an operating system. For those of you who do not know what an operating system is, and for all of you who think you do but may have forgotten what an operating system is, it is actually the software layer that is between your hardware and the software that allows you to get something productive done on a computer.
The operating system is what allows the software to talk to the hardware. It is the one that lets you store information on hard drives, send out print jobs to printers, etc. If you are in a normal Windows environment. a Microsoft Windows Operating system. you have your hardware at the bottom, you have the Windows operating system on top of that, and then you have Microsoft Office, for example, that sits on top of the operating system.
Linux is an operating system that acts as an intermediary—i.e. a bridge—between the physical device and the instructional code of a program. The main thing that you just need to realize is that in the Linux world, the software that you will be running is of a completely different type, compared to the ones that you would run in the Windows operating system. Desktop applications like Microsoft Office and Adobe Photoshop are not usually run on a Linux environment. Linux normally
runs servers. Apache web servers, database servers, web virtualization servers, etc.
Linux is a Unix-like and mostly POSIX-compliant computer operating system assembled under the model of free and open-source software development and distribution.
More About Linux Operating System
Linux usually works as a server, because of its stability and security’s feature. Linux programs are extremely advantageous:
Linux programs are free, you’ll see, most Linux programs are.
They are frequently updated and for Zero charges!
Some of them are better than those in windows. And other doesn’t even exist in windows!
If Linux is free and almost all their softwares are free, it is for a reason; to understand we have to go back to 1984.
1984
So we are back in 1984, computer science was not very developed. Microsoft has just launched its first os: MS-DOS, but this one is far away from being done.
But, was MS-DOS the only one then? No! There was another operating system but less known by the public.
The one that was called the best was “Unix”. It was a lot powerful than MS-DOS but a lot complicated, which explains that only the professionals could use it.
Graphically UNIX looked a lot like MS-DOS they were both seen like a black screen with some white text in it. We must say that computers back then were not capable of doing better.
GNU Project
It is just in 1984, that Richard Stallman created GNU project.
The GNU Project is free software, mass collaboration project, announced on 27 September 1983, by Richard Stallman at MIT. Its aim is to give computer users freedom and control in their use of their computers and computing devices, by collaboratively developing and providing software that is based on the following freedom rights: users are free to run the software, share it (copy, distribute), study it and modify it.
GNU software guarantees these freedom-rights legally (via its license), and is therefore free software; the use of the word “free” always being taken to refer to freedom.
Richard Stallman was a researcher in Artificial intelligence in MIT. He wanted to create an operating system based on UNIX (the commands still the same).
But why would he create a copy of “UNIX”?
Because UNIX was not free and it was getting more expensive! Richard Stallman wanted to react by creating a free alternative: the project GNU was born.
GNU is an open operating system

GNU should not only be a free OS; it also had to be “open”
What is the difference?
A free program is a program where you can have the source code, that is to say, the “batch recipe.” In contrast, Windows is a proprietary OS whose source code is stored by Microsoft. Imagine it’s like Coca-Cola: nobody knows the recipe (there are many people who try to imitate it, but hey …). So we cannot change it or see how it works inside.
An open program is mostly a free program, it is also a program that has the right to copy, modify, redistribute. It’s a real ideology in computer science: people think it is better to give the source code of the programs that we create because it allows knowledge sharing and helps the computer to evolve faster. The slogan of the Free World might be: “Unity is strength.”
They say whenever the program is “open source” because its source code is open; everyone can see it. There are some slight differences between “open source” program and a “free” program, but we will not go into details here.
Linus Torvalds is doing his hobby
In 1991, Linus Torvalds, a student at the University of Helsinki (Finland), began creating his free own operating system. This system became known as Linux, referring to the name of its creator (Linux is a contraction of Linus and UNIX).
Linus Torvalds, creator of Linux
What relationship with GNU? Well it turns out that these two projects were complementary: while Richard Stallman created the basic programs (program file copy, delete, file, text editor), Linus had embarked on the creation of the “heart” an operating system kernel.
The GNU (free programs) and Linux (OS kernel) project merged to create GNU / Linux.
Theoretically, we should talk about GNU / Linux. But it is a bit difficult to write and pronounce, and by abuse of language, we often say just “Linux”. This is why I continue to speak of “Linux” in the rest of the book, even though the politically correct name is “GNU / Linux” because it is the merger of two complementary projects.
Original operating systems
You should now have a better idea of the origin of the three major operating systems that exist today: Mac OS, Linux and Windows.
Thus, Mac OS and Linux are both based on UNIX, the ancestor of operating systems, while Windows, from MS-DOS is a separate branch. Overall, this is all you need to remember.
It is said that Mac OS and Linux are based on UNIX because they have “copied” its operation. It’s not pejorative, it’s quite the opposite: it’s been an honor to UNIX.
Linux programs do not use all the same source code as UNIX (it was also the owner, so private). They have been completely rewritten but work the same way.
If I told you all this is because I believe that knowing the origin of Linux is important. This will help you understand many things thereafter.
Also Read: What is API
Linux distributions
A Linux distribution (often called distro for short) is an operating system made as a collection of software-based around the Linux kernel and often around a package management system. The most well-known distributions are RedHat, SUSE, Debian, Mandriva, Slackware, and Ubuntu. You can find much different software and there are hundreds of different ways to install it.
To make life easier for users and allow them to make a choice, different Linux distributions were created. This is a concept that does not really exist in Windows. It’s like the difference between Windows 7 Home and Windows 7 Professional, but it goes much further than that.
Here’s what can differ from one distribution to another:
Installation: it can be greatly simplified as very complicated;
Installing management programs: If it is done well and centralized, it can make the installation of new software simpler than Windows, as discussed further!
The preinstalled programs on your computer (e.g. Windows is bundled with Internet Explorer and Windows Media Player).
In fact, distribution is somehow packing Linux. The heart itself remains the same for all distributions. Whichever distribution you install, you get a Linux compatible with others. Some distributions are just more or less easy to handle.
Various existing distributions
There are many different Linux distributions. Hard to choose, you will say: indeed, the first time it is unclear what to choose … especially since all are free! Do not worry; I’ll help you make your choice.
I will not list all existing distributions, but here at least the main ones:
Slackware: one of the oldest Linux distributions. It still exists today!
Mandriva: published by a French company, it is simple to use;
RedHat: published by an American company, this distribution is known and widespread, especially on servers;
SUSE: Novell published by the company;
Debian: Debian distribution alone which is managed by independent developers rather than a business. This is one of the most popular distributions.
As I have said, whatever the distro (short for distribution) you choose, you will have a Linux. Basically, “just” a screen on first boot and various software preinstalled (I’m simplifying a bit much, but the idea is there).
Summary
Windows, Mac OS and Linux are the most popular operating systems.
Linux usually works as a server, because of its stability and security’s feature.
Linux has the distinction of being free, that is to say that its source code (the manufacturing recipe) is open: anyone can view it. In contrast, the source code that was used to design Windows and Mac OS is closed; we say that these are proprietary operating systems.
There are many variants of Linux, called distributions.
Getting Started With Linux Commands

I assure you, we will start with simple things to become familiar with the console. We’ll really see the ABC, the basic survival guide of kits.
Also Read: What is Web Hosting?
Basic Linux Commands in 2021
a2p
translate awk to perl
e.g. a2p myfile.awk> myfile.pl
(translate myfile.awk into pl file)
alias
create another name for a command
e.g. alias p=”pwd”
(set p as alias for pwd)
apropos
view the searched term in man pages
e.g. apropos find
(list entries with “find” in man page)
apropos -e
view searched term in man pages
e.g. apropos –e nice
(-e: show exact word in man pages)
apt-get
install, remove or update a package
e.g. apt-get install libc6
(install libc6 package)
aspell
check and correct for misspellings
e.g. aspell -c test.txt
(-c:check spelling in test.txt file)
at
run a job at a schedule time
e.g. at 1 AM Fri
(run the job at 1am Friday)
awk
match text by regular expression
e.g. awk ‘length($0) > 88’ text.txt
(list only lines longer than 88 words)
basename
display the last part of a file path
e.g. basename /home/foo/usr/file.txt
(output: file.txt)
bc
perform a calculation by a calculator
e.g. bc 8+9
(output: 17)
bg
resume a stopped job in background
e.g. bg %3
(resume %3 job in background)
bunzip2
uncompress a file from zip format
e.g. bunzip2 myfile.tar.bz2
(uncompress myfile.tar.bz2)
bzip2
compress a file to zip format
e.g. bzip2 myfile.dat
(compress myfile.dat)
cal
display a month or year calendar
e.g. cal 2014
(display 2014 calendar)
cal -3
display a month or year calendar
e.g. cal -3
(-3:display 3 months)
cat
display contents of one of more files
e.g. cat file1.txt file2.txt
(display contents of file1 and file2)
cat -n
display contents of one of more files
e.g. cat –n myfile.txt
(-n: specify number of output lines)
cd
change directory
e.g. cd /home/user/mydir
(change current directory to mydir)
chattr
set attributes for a file
e.g. chattr +i myfile.txt
(+i make the file as read-only)
chfn
change user’s finger information
e.g. chfn
(change all users information)
chfn -f
change user’s finger information
e.g. chfn –f Full-Name
(-f: change full name)
chgrp *
change the group ownership
e.g. chgrp groupname /usr/myfile.txt
(alter group ownership of myfile.txt)
chkconfig*
view and modify run level file
e.g. chkconfig –list
(-list: list services of run level)
chmod
change access permission
e.g. chmod 755 filename
(set file access permission as 755)
chown *
change ownership of file or directory
e.g. chown username myfile.txt
(alter file ownership of myfile.txt)
chpasswd*
change password for users.
e.g. chpasswd
(then enter username: password)
chsh *
change login shell for a user
e.g. chsh -s /bin/bash ray
(-s specify login shell)
cksum
produce a CRC checksum number
e.g. cksum file.txt
(output checksum number of file.txt)
clear
clear the screen.
e.g. clear
(clear the shell window)
cmp
compare two files text byte by byte
e.g. cmp first.txt second.txt
(compare first.txt and second.txt)
Also Read: What is a Domain Name
collectl
monitor the current system status
e.g. collectl
(list cpu, sys, inter .etc information)
comm
compare two files text line by line
e.g. comm first.txt second.txt
(compare first.txt second.txt)
cp
copy file(s) to another directory
e.g. cp myfile.txt /mydir
(copy myfile.txt to mydir)
cp -p
copy file(s) to another directory
e.g. cp –p myfile.txt /mydir
(-p: keep original permission)
cp -a
copy file(s) to another directory
e.g. cp –a myfile.txt /mydir
(-a: keep original attributes)
cpio -o
output archived cpio file
e.g. cpio -o > directory.cpio
(-o: backup to an archive cpio file)
cpio -i
input archived cpio file
e.g. cpio -i < directory.cpio
(-i: restore from an archive cpio file)
crontab
create a job to run at specified time
e.g. crontab
(set to run jobs at regular intervals. )
crontab -e
run a recurring job at a specified time
e.g. crontab -e
(-e allow edit the crontab file)
crontab -l
run a recurring job at a specified time
e.g. crontab -l
(-l: lists the crontab files)
crontab -r
run a recurring job at a specified time
e.g. crontab -r
(-r: remove the crontab file)
csplit
split a file into some separated files
e.g. csplit myfile.txt ”/part1/” “/part2/”
(separate files named xx00, xx01)
cut -d
show the specified field of a file
e.g. cut –d “:” myfile.txt
(-d: specify a field delimiter “:”)
cut -c
extract contents from a file
e.g. cut –c 6 myfile.txt
(-c6: the sixth character of each line)
cut -f
extract contents from a file
e.g. cut –f 3 myfile.txt
(-f3: specify a field number as 3)
date
show the date and time
e.g. date
(display the current date and time)
date -s
set the date and time
e.g. date -s “11/20/2014”
(-s set the date)
dc
open a command line desk calculator
e.g. dc
( “dc” means desk calculator)
dd
data dump to convert and copy a file
e.g. dd if=/dev/sda of=/dev/sdb
(copy data from sda to sdb)
dmesg
print out all kernel log messages
e.g. dmesg > kmsg.txt
(output kernel messages to kmsg.txt)
df
display free disk space
e.g. df
(display file system free space)
df -m
display free disk space
e.g. df -m
(-m: display sizes in Mb)
dhclient
configure network interfaces
e.g. dhclient eth0
(renew IP address of eth0)
diff
show difference between two files
e.g. diff firstfile.txt secondfile.txt
(display difference above two files)
diff3
show difference among three files
e.g. diff3 file1.txt file2.txt file3.txt
(display difference above three files)
dig
display the details of DNS servers
e.g. dig xvxaxx.com
(list information about xvxaxx.com)
dir
show directory contents
e.g. dir
(display current directory contents)
dircolors
show color settings for “ls” command.
e.g. dircolors
(display directory coloring of ls)
dirname
remove the last part of a file path.
e.g. dirname /foo/bar/baz/myfile.txt
(output: /foo/bar/baz)
du -s
display disk usage
e.g. du -s .
(-s list files size in current directory)

du -h
display disk usage
e.g. du -h myfile.txt
(-h: show human readable units)
dump -f
makes backup of filesystem
e.g. dump -f0 filebk /mydir
(-f:backup-0:dump-level filebk: dump-file)
echo
display input on standard output
e.g. echo “Hello World!”
(show “Hello World!”)
echo -e
display text using escape sequence
e.g. echo –e “\n Hello World!”
(-e: allow use \n to show text)
ed
open a command-line text editor
e.g. ed myfile.txt
(open myfile.txt with text editor)
egrep
search file(s) for a specified regex
e.g. egrep “new | string” myfile.txt
(search myfile.txt for “new | string”)
eject
eject the cd or dvd tray
e.g. eject cdrom
(eject cdrom tray)
eject -t
eject or close the cd or dvd tray
e.g. eject –t cdrom
(-t: close an open cdrom tray)
emacs
powerful, extensible file editor
e.g. emacs file.txt
(launch emacs and open file.txt )
env
show, set the environment variables
e.g. env
(list current environment variables)
eval
make a command from its arguments
e.g. UPLS=”eval cd.. ; ls ”
(create a command named UPLS)
exit
exit the shell
e.g. exit
(terminate the program and log out)
expand
convert tabs into spaces
e.g. expand myfile.txt
(convert tabs to spaces for myfile.txt)
expand -t
convert tabs into spaces
e.g. expand -t 3 myfile.txt
(-t: set tabs 3 characters apart)
export
set an environment variable & value
e.g. export newvar=8 echo $newvar
(output: 8)
expr
evaluate an expression
e.g. expr 10+8
(output: 18)
factor
show the prime factors of a number
e.g. factor 1001
(output: 7 11 13)
fc
list, edit, re-execute last commands
e.g. fc -l
(-l:list the history of commands)
fdisk*
manipulate the hard disk partitions
e.g. fdisk /dev/hdb
(list hard disk partitions information)
fg
resume a stopped job in foreground
e.g. fg %3
(resume the job 3 in foreground)
fgrep
search file(s) for a specified string
e.g. fgrep “good” myfile.txt
(search myfile.txt for “good”)
file
detect the file type.
e.g. file myfile.tar
(determine file type of myfile.tar)
find –print
find file(s) in a directory named dir
e.g. find dir -print -name ‘abc.txt’
(-print:print, -name:specify file name)
finger
show user’s information
e.g. finger username
( list the user’s login name, time. etc.)
fmt
format text files
e.g. fmt myfile1.txt > myfile2.txt
(format myfile1 & output to myfile2)
fmt -u
format text files
e.g. fmt –u myfile.txt
(-u: provide uniform word spacing)
fold
wrap each line to fit a specified width
e.g. fold -w 15 myfile.txt
(-w specify how many words)
for in
set conditional parameter for loop
e.g. for n in 3 6 9 do echo $n done
(output: 3 6 9 )
free
displays free memory information
e.g. free
(list free, used, total memory…)
free -m
displays free memory information
e.g. free -m
(-m: show sizes in Mb.)
fsck *
file system check
e.g. fsck
(check or fix Linux file system)
ftp
transfer files by File Transfer Protocol
e.g. ftp ServerURL
(transfer files using ftp)
gawk
find or replace text in a file
e.g. gawk ‘length($0) > 88’
(list lines longer than 88 characters)
grep
match a specified string or regex.
e.g. grep onestring myfile.txt
(search myfile.txt for onestring)
groups
list groups to which the user belongs
e.g. groups
(print the groups of user)
groupadd *
add a new group
e.g. groupadd newgroup
(create a new group)
groupadd * -f
add a new group
e.g. groupadd –f newgroup
(-f: check group doesn’t exist)
groupdel *
delete an existing group.
e.g. groupdel existinggroup
(remove an existing group)
groupmod *-n
modify an existing group
e.g. groupmod -n newgrp oldgrp
(-n change group name)
gunzip
uncompress a file from gzip format
e.g. gunzip myfile.txt.gz
(uncompress myfile.txt.gz)
gzip
compress a file to gzip format
e.g. gzip myfile.txt
(compress myfile.txt)
halt
shutdown the system
e.g. halt
(power off the system)
hash
access the hash table
e.g. hash
(list commands from hash table)
head
display some front lines in a file
e.g. head myfile.txt
(output the first ten lines of myfile.txt)
head -n
display some front lines in a file
e.g. head –n 4 myfile.txt
(-n: specify a number of lines)
help
show help information of commands
e.g. help echo
(show information about echo)
history
show the commands history
e.g. history
(list commands in this shell session)
host
find the ip address of a domain name
e.g. host websprogram.com
(show ip of websprogram.com)
hostid
display id of the current host in hex.
e.g. hostid
(print the current host id)
hostname
show or set the host name
e.g. hostname
(display the name of current host )
id
show the user or group id number
e.g. id
(display the root user uid, gid. etc.)
ifconfig
show, configure the network interface
e.g. ifconfig
(display the network settings)
init *
set the system run level
e.g. init 5
(change to run level 5)
info
show help information of a command
e.g. info man
(show help page for man)
install
copy files, set permission, ownership
e.g. install myfiles /home/user
(copy myfiles to user directory)
install -o
copy files, set permission, ownership
e.g. install –o myfiles ray /home
(-o: specify ownership)
jobs
show all jobs’ status
e.g. jobs
(list all running jobs’ information)
join
join lines of files having common field
e.g. join myfile1.txt myfile2.txt
(join lines of two files by same field)
join
join lines of two files
e.g. join –i myfile1.txt myfile2.txt
(-i: ignore the differences)
kill
stop a job by number.
e.g. kill %3
(terminate job %3)
kill
stop a process by pid.
e.g. kill 3956
(terminate process 3956)

killall
stop a process by name
e.g. killall no respond
(terminate process no respond)
last
show most recently logged-in users
e.g. last
(list recent users’ date, time…)
lastb
show bad login attempts
e.g. lastb
(display bad login attempts)
lastlog
display the last login information
e.g. lastlog -u username
(-u: specify a user)
less
show contents page by page
e.g. less myfile.txt
(display myfile.txt page by page)
let
perform arithmetic on shell variables
e.g. let a=12; let a=a+8; echo $a
(output: 20)
link
create a link to a file.
e.g. link file1.txt file2.txt
(create a link from file1 to file2)
ln
create a hard link to a file
e.g. ~/myfile.txt
(create a hard link to myfile.txt)
ln -s
create a link between two files
e.g. ln -s file1.txt file2.txt
(create a symbolic link to file1/file2)
locate
find the location of a file or a directory
e.g. locate myfile.txt
(locate myfile.txt on local machine)
logname
show the current user’s login name
e.g. logname
(display the login name of user)
look
show words matching a given prefix
e.g. look ab
(output: aba, abb, abc, abd…)
lpc
run the line printer control program
e.g. lpc status
(show status of current print queue)
lpq
show the printer queue status
e.g. lpq
(list the print queue)
lpr
send a print request to printer
e.g. lpr myfile.txt
(send myfile.txt to printer)
lprm
cancel the printing job in print queue
e.g. lprm 2
(remove printing job 2)
ls
list the contents of current directory
e.g. ls
(list files and sub-directories)
ls -l
long list contents of current directory
e.g. ls -l
(-l:long lists including permissions)
ls -a
lists all entries including hidden files
e.g. ls -a
(-a: show all files)
ls -t
lists all entries by time stamps
e.g. ls -t
(-t: show by time stamps)
ls -lh
lists contents in current directory
e.g. ls -lh
(-lh: list files with size in mb and gb. )
lsattr
list the attribute of a file or a directory
e.g. lsattr myfile.txt
(show myfile.txt attribute)
lsof
list opened files
e.g. lsof
(list all opened files)
man
get command help from manual
e.g. man cat
(show manual page for cat)
man -k
search manual pages for keyword
e.g. man –k printf
(-k: specify a keyword)
md5sum
create a md5 checksum number
e.g. md5sum -c file.txt
(-c validate file against a checksum)
mesg
enable or disable messaging
e.g. mesg
(show the current write status)
mesg y/n
enable or disable messaging
e.g. mesg y/n
(y or n: permit or deny messaging)
send and receive mails
e.g. mail ray@websprogram.com
(email to ray@websprogram.com)
mkdir
make a new directory
e.g. mkdir mydir
(create a directory named mydir)
mknod
make a device file
e.g. mknod /dev/dk b 45 0
(dk:device; b:block; 45:major no.; 0:minor no.)
more
show content one screen at one time
e.g. more +2 myfile.txt
(+2: beginning at line 2)
mount
mount a storage device
e.g. mount /dev/cd
(mount a device cd)
mount -l
mount or show devices
e.g. mount -l
(-l: list all mounted devices)
mt
magnetic tape drive control
e.g. mt -f /dev/tape eod
(-f select eod; move to end of data)
mv
move a file to another directory
e.g. mv myfile.txt /home/user/mydir
(move myfile.txt to mydir directory)
mv
rename a file
e.g. mv myfile1.txt myfile2.txt
(rename mayfile1 to myfile2)
netstat
display network status
e.g. netstat
( print network connections, routing tables.etc )
nice *
set the priority level of a job
e.g. nice -19 ftp
(set priority level as 19 for ftp)
nl
add text with number lines
e.g. nl mylist.txt
(make number lines for mylist.txt)
nohup
ignore hangup signals
e.g. nohup find ftp
(run ftp ignoring hangup signals)
nslookup
query internet name servers for IP
e.g. nslookup myxxexample.com
(return IP like 75.126.162.XXX)
passwd
modify a user password
e.g. passwd username
(change password for username)
paste
merge lines of multiple files
e.g. paste file1.txt file2.txt
(merge contents for file1 and file2)
pidof
show process ID of running program
e.g. pidof console
(display console’s process id)
ping
send data to a host, await response
e.g. ping xvxmjfz.com
(test if remote host can be reached)
ping -c
test if remote host can be reached
e.g. ping –c5 xvxmjfz.com
(-c5: specify the number of pings)
pkill
kill a running process
e.g. pkill firefox
(stop web browser firefox)
pr
prepare text files for printing
e.g. pr myfile.txt
(prepare myfile.txt for printing)
pr -n
prepare text files for printing
e.g. pr –n myfile.txt
(-n: specify number in each line)
pr -h
prepare text files for printing
e.g. pr –h “Good” myfile.txt
(-h: specify a header)
printenv
show the environment variables
e.g. printenv
(list values of environment variables)
printf
format and print data
e.g. printf “start\b”
(\b: backspace output: star)
printf
format and print data
e.g. printf ‘hello \n world \n !’
(\n: prints by newlines. output 3 lines)
ps -f
show the process status
e.g. ps -f
(-f full information of current process)
ps -u
show the process status
e.g. ps -u ray
(-u specify a user’s current process)
pstree
displays process in tree structure
e.g. pstree
(show all process as a tree)
pwd
print working directory
e.g. pwd
(display current directory)
rcp
remotely copy file between two hosts
e.g. rcp file.txt host2:/dir2/file.txt
(remotely copy file.txt to host2)
read
read a line from standard input
e.g. read name (input ray)
echo “$name” (output ray)
reboot*
restart the system
e.g. reboot
(cause the computer to restart)
renice *
change the priority level of a job
e.g. renice 3 23001
(set priority level as 3 for job 23001)
restore
restores data from the backup file
e.g. restore -f databackup
(-f:specify a backup file)
rlogin
remotely login to a system
e.g. rlogin -l username domain.com
(-l: specify a username)
rm
remove one or more files
e.g. rm myfile.txt
(remove myfile.txt)
rm -r
remove non-empty directory
e.g. rm -r /NonEmptyDir
(-r: remove directory and its content)
rm -i
remove non-empty directory or a file
e.g. rm -i myfile.txt
(-i: ask before removing)
rmdir
remove empty directory
e.g. rmdir /emptydir
(delete directory without contents)
route
show or modify the IP routing table
e.g. route -n
(-n: show in numerical format)
rsync
remotely synchronize files
e.g. rsync myfile host2:/dir2/myfile
(sync. myfile with remote host2)
scp
securely copy files amid two hosts
e.g. scp file.txt host2:/dir2/file.txt
(securely copy file to remote host2)
screen
open the terminal window manager
e.g. screen
(start a new screen)
sdiff
show two files’ difference side by side
e.g. sdiff myfile1.txt myfile2.txt
(compare two files side by side)
sed
filter and transform input text
e.g. sed “{print $3}” myfile.txt
(display the third word of each line)
seq
list sequent numbers in given range
e.g. seq 1 8
(output: 1 2 3 4 5 6 7 8)
seq -w
list sequent numbers in given range
e.g. seq –w 1 3
(-w: with zeros output: 01 02 03 )
seq
list sequent numbers in given range
e.g. seq –s| 1 3
(-s: with separators output: 1| 2 |3 )
set
set shell variable or function
e.g. set n=who am i
; echo $n
(output: who am i)
sftp
securely transfer files by ftp
e.g. sftp SeverURL
(securely transfer files to a Server)
shopt
show the shell option settings
e.g. shopt
(show the shell behavior settings)
shutdown *
close system
e.g. shutdown 22:00
(shut down at 22:00 o’clock)
shutdown-h
close system
e.g. shutdown –h +5
(-h+5: halt after 5 minutes)
shutdown -r
shutdown and restart
e.g. shutdown -r now
(-r:shut down and instantly restart)
sleep
pause for a specified amount of time
e.g. sleep 10
(pause for 10 seconds)
sort
show sorted contents alphabetically
e.g. sort -r myfile.txt
(-r sort file in reverse order)
split -b
split a file to some files in given size
e.g. split -b 11 file.txt
(split file to some 11 byte files named xaa,xab,xac, etc.)
split -l
split a file to some files in given size
e.g. split -l 8 file.txt
(split file to some 8 line files named xaa,xab,xac, etc.)
ssh
login to remote secure shell
e.g. ssh ray@myexample.com
(securely connect to a remote host)
ssh -l
login to remote secure shell
e.g. ssh -l username hostname
(-l specify your remote username)
stat
list status about file size, access, etc.
e.g. stat myfile.txt
(show myfile.txt statistics)
su
switch user
e.g. su user2
(switch user named user2)
su -l
login as a root super user
e.g. su –l
(-l:enter password, login root account )
sudo -u
execute a command as another user
e.g. sudo -u user2 ls /home/mydir
(-u: specify user2 to execute ls cmd)
sudo -v
refresh the authentication timeout
e.g. sudo -v
(next sudo will not require password.)
sudo -k
expire the authentication timeout
e.g. sudo -k
(next sudo will require password.)
sum
summarize a file with a checksum
e.g. sum myfile.txt
(create a checksum for myfile.txt)
suspend
suspend the working shell
e.g. suspend
(pause system during execution)
sync
synchronize disk data with memory
e.g. sync
(flush all file system buffers to disk)
tac
display lines of a file in reverse order
e.g. tac myfile.txt
(print file from last line to first line)
tail
show the final part of a file
e.g. tail -n 20 file.txt
(-n20:output last 20 lines of file.txt)
talk
communicate with another user
e.g. talk ray
(talk to user ray)
tar -xf
extract an archived tar file
e.g. tar -xf archive.tar
(-xf: extract an archive tar file)
tar -cf
create an archived tar file
e.g. tar -cf archive.tar
(-cf: create an archive tar file)
tee
print standard output, write to a file
e.g. sort file1.txt | tee file2.txt
(sort file1.txt and write to file2.txt)
tee -a
print standard output, write to a file
e.g. sort file1.txt | tee –a file2.txt
(-a: append instead of overwrite)
test
calculate a boolean expression
e.g. [ 8 -gt 6 ]; echo $?
(output: 0 0:true; 1:false)
test
calculate a boolean expression
e.g. [ 5 -eq 6 ]; echo $?
(output: 1 0:true; 1:false)
time
show the time taken to run a program
e.g. time ftp
(display the time taken to execute ftp)
times
show the uptime of sell
e.g. times
(display the system uptime)
tload
show a graphic report of system load
e.g. tload
(show the current system load average to a specified process)
top
list the top active or specified process
e.g. top -p pid
(-p:display specific process by pid)
touch
update timestamp for an existing file
e.g. touch myfile.txt
(modify myfile.txt to the current time)
touch -t
update timestamp for an existing file
e.g. touch –t myfile.txt
(-t: specify a time)
tr
translates sets of characters
e.g. echo apple | tr “apple” “banana”
(output: banana)
traceroute*
trace the route to a host
e.g. traceroute xvauhdhxv.com
(trace packets route to another host)
trap
run a command on receiving a signal
e.g. trap
(display the current signal traps)
tree -p
list directory contents in tree format
e.g. tree –p
(-p: also show the file permissions)
tty
show the name of the terminal device
e.g. tty
(show the terminal filename)
type
detect the type of a command
e.g. type wait
(output: wait is a shell builtin)
ulimit -a
limit user resources
e.g. ulimit -a
(-a:display all limits for the system)

umask
show or set the file permission value
e.g. umask 0022
(allow user read, write privileges and all others to read)
umask
show or set the file permission value
e.g. umask 0002
(allow group read, write privileges and all others to read)
umask
show or set the file permission value
e.g. umask 0077
(allow user read, write privileges and no for others)
umount
unmount a device or filesystem
e.g. umount /dev/dvd
( unmount a device DVD )
unalias
remove an alias
e.g. unalias aliasname
( delete a specified alias)
uname -a
show the current system information
e.g. uname -a
( -a: display all information)
uname -n
show the current system information
e.g. uname -n
( -n: display the host name)
unexpand
convert spaces into tabs
e.g. unexpand myfile.txt
(convert spaces to tabs for myfile.txt)
uniq
filter out repeated lines in a file
e.g. uniq myfile.txt
(show unique line in myfile.txt)
unset
remove shell variable or function
e.g. unset var
(delete a variable)
unzip
uncompress files from zip format
e.g. unzip archive.zip
(uncompress file from archive.zip)
uptime
show system uptime
e.g. uptime
(display system uptime)
useradd *
add a new user account
e.g. useradd username
(create a user account)
useradd* -d
display default value for new users
e.g. useradd -d
(show default data for a new user)
userdel *
delete an existing user account
e.g. userdel username
(remove a user account)
usermod* -d
modify home directory
e.g. usermod -d /home/mydir andy
(-d: specify home directory for andy.)
usermod * -l
modify an existing user account
e.g. usermod -l oldname newname
(-l: login name change)
usermod * -p
modify an existing user account
e.g. usermod -p password username
(-p:modify password of a user)
users
display current logged-in users
e.g. users
(list users currently logged in)
vdir
verbosely show directory contents
e.g. vdir
(vdir just like ls, but more verbose)
vi
open the vi text editor
e.g. vi filename
(open a file with vi text editor)
vmstat
report virtual memory statistics…
e.g. vmstat
(also report swap, disk i/o devices…)
w
list current processes for each users
e.g. w username
(show the user’s process)
w -s
list current processes by summary
e.g. w -s
(-s: show a summary of shell process)
wait
wait for a process to change state
e.g. wait 10788
(wait for 10788 to change state)
watch
execute a command periodically
e.g. watch –n 5 date
(-n5:update date every 5 seconds)
wc
show word count, line count, etc
e.g. wc myfile.txt
(list word, line count… for myfile.txt)
wc -c
show word count, line count, etc
e.g. wc –c myfile.txt
(-c: show the byte counts)
wget
download a web page from a website
e.g. wget
(download webpage from above url)
wget -c
download a web page from a website
e.g. wget –c http://www.examp.com
(-c: continue download previous web)
whatis
show manual page of a command
e.g. whatis ping
(show manual page of ping)
whereis
locate source, man for a command
e.g. whereis ls
(show source, man locations of ls)
which
show path of a executable command
e.g. which ftp
(show the full path of ftp command)
who
show who currently logged in
e.g. who
(list all logged-in users, date, time…)
who -a
list all users currently logged in
e.g. who -a
(-a: all information)
whoami
show the current user’s login name
e.g. whoami
(show your own user name)
whois
show domain owner’s information
e.g. whois xvqizx.com
(list xvqizx.com owner’s information)
write
write a message to another user
e.g. write username
(then write your message…)
xargs
execute a command with arguments
e.g. find -name ” a. ” | xargs rm
(find files named a., remove them)
xcalc
launch a graphical calculator
e.g. xcalc
(open a scientific calculator)
xclock
launch graphical clock
e.g. xclock -digital
(-digital: specify a digital clock)
yes
output a string repeatedly until killed
e.g. yes “hello”
(output hello repeatedly until killed)
yum
rpm-based package manager
e.g. yum install update
(install a package named “update”)
zcat
output compressed text
e.g. zcat myfiles.txt.gz | less
(uncompress file and show contents)
zless
show un/compressed file contents
e.g. zless myfile.txt.gz
(zless: show contents by page)
zmore
show un/compressed file contents
e.g. zmore myfile.txt.gz
(zmore: show contents by screen)
zip
compress files to zip format
e.g. zip documents *
(create documents.zip for all files)
unzip
uncompress files from zip format
e.g. unzip myfile.zip
(uncompress myfile.zip.)
It’s a pity you don’t have a donate button! I’d definitely donate to this excellent blog! I guess for now i’ll settle for book-marking and adding your RSS feed to my Google account. I look forward to brand new updates and will talk about this website with my Facebook group. Chat soon!|
Hello mates, how is everything, and what you want to say concerning this article, in my view its actually remarkable for me.|