Bash Shell Command List (Linux)

categorycommanddescription
basic shellclearclear all previous commands’ output text from the terminal
exit (or logout)quits the shell
alias, unaliasgive a pseudonym to another command
(you may need to enclose the command in quotes if it contains spaces or operators)
historyshow a list of all past commands you have typed into this shell
directorieslslist files in a directory
pwddisplays the shell’s current working directory
cdchanges the shell’s working directory to the given directory; can be a relative or absolute path
mkdircreates a new directory with the given name
rmdirremoves the directory with the given name (the directory must be empty)
file operationscpcopies a file/directory
mvmoves (or renames) a file/directory
rmdeletes a file
touchupdate the last-modified time of a file (or create an empty file)
file examinationcatoutput the contents of a file
more (or less)output the contents of a file, one page at a time
head, tailoutput the beginning or ending of a file
wcoutput a count of the number of characters, lines, words, etc. in a file
dureport disk space used by a file/directory
diffoutput differences between two files
file permissionschmodchange the permissions on a file or group of files
chownchange the owner of a file
chgrpchange the group associated with a file
umaskchange the default permissions given to newly created files
searching and sortinggrepsearch a file for a given string or expression
sortconvert an input into a sorted output
uniqstrip duplicate lines
findsearch for files by name within a given directory
xargs launch a command over each of a set of lines of input (often used with find)
locatesearch for files by name on the entire system
whichshows the complete path of a command or file
compressionzip, unzipcreate a .zip archive or extract its contents
tarUnix archiving/de-archiving program
gzip, gunzipGNU compression/decompression programs
bzip2, bunzip2improved compression/decompression programs
system informationdateoutputs the current date/time
caloutputs an ASCII calendar
unameprint information about the system
timemeasure how long a program takes to run
process managementps, jobslist the processes you are running; every process has a unique integer id number (PID)
topsee what processes are using the most CPU/memory, and show system memory/CPU stats
killterminate a process
killallterminate a group of processes by name
^C or ^\(hotkey) terminates (kills) the currently running process
^Z(hotkey) suspends the currently running process
&(special character) when & is placed at the end of a command, that command is run in the background (shell does not wait for the command to finish before returning to the input prompt)
bg, fgstarts a suspended process running in the background or foreground
users and groupswhoamioutputs your user name
passwdchanges your password
groupslist the groups to which a user belongs
sudoexecute a single command as the super-user
sulog in to a shell as the super-user
multi-user environmentshostnameoutputs the name of the current computer/server
w, fingersee who is logged in to this computer
writesends a message to another user logged in to this computer
wallbroadcasts a message to all other users logged in to this computer
.plan(filename) a special hidden file you can create in your home directory, whose contents will be displayed when other users run finger on you. Was originally intended to be used to tell others what you are up to right now. (the Twitter of the 1970s!)
networklinks, lynxtext-only web browsers (yes, really)
ssh, sftp, scpconnect to a remote Unix server; open a shell on it or send/receive files from it
wgetdownload from a URL and save it to a file on the local hard drive
curldownload from a URL and output its contents to the console
pine, mailtext-only email programs
text editorspico, nanocrappy but simple text editors (recommended)
emacsa complicated text editor (not recommended)
vi, vimanother complicated text editor (not recommended)
regular expressionssedstream editor; find/replace based on regular expressions
egrepextended version of grep that matches regular expressions
programmingjavac, javacompile or run a Java program
python, perl, ruby,
gcc, sml, …
compile or run programs in various other languages
shell scriptingecho, printf like println for the shell; outputs a message or value
read reads a value from standard input
set, unset give values to a variable, or delete a variable
export sets a variable that any sub-programs launched by this shell can see
let for computing integer variable values
source executes commands/statements stored in another file
(useful for re-loading .bash_profile without logging out)
if, [, for, while bash control statements
seq outputs a sequence of integers (used with for loops)
miscellaneousyesoutput "y" (or another string) over and over
sleep, usleeppause for a given number of seconds or ms
~stepp/cowsay displays a talking ASCII cow (on attu only, though you could install it if you are using Linux on a PC)
xeyes googley eyes that follow your mouse cursor
build managementmakedetermine which parts of a system must be recompiled, and compile them
svn, cvsSubversion and CVS version-control systems
  • Source: https://courses.cs.washington.edu
Posted in General.

Leave a Reply

Your email address will not be published. Required fields are marked *