UNIX / Linux

I'm compiling a list of what I consider to be the most useful shell commands and programs for Unix/GNU/Linux systems (i.e. POSIX-compliant systems).  Later, I will explain what they do and give examples of their usage. There are already many similar pages online, but this will be more concise than most. Here are some examples of similar pages:

www.tutorialspoint.com/unix/unix-basic-operators.htm
www.computerhope.com/unix.htm ss64.com/bash/

Here's a more comprehensive list: 

dontfearthecommandline.blogspot.com/2009/08/unix-linux-and-bsd-command-line-cheat.html

Operators / Special symbols:

Symbol

Usage

. Usage 1: A shortcut for the current working directory, synonomous with the command $(pwd) 
Usage 2: Place at the beginning of a directory or file name to hide the directory or file.

Example 1: To execute the file "run.sh" located in the current active directory, simply issue the command

./run.sh

Eample 2: To copy the file "text.pdf" from /home/username/Documents/ to the current working directory:

cp /home/username/Documents/text.pdf .

Example 3: The file named .settings will be treated as a hidden file. Similarly, the directory named .config will be hidden.

 

~ A shortcut for your home directory.  If your username is "nathaniel", then ~ is equivalent to /home/nathaniel 



Example: Running the command

cd ~/Desktop

will change the working directory to /home/nathaniel/Desktop Note: A file with a tilde as the last character in is name, for instance, a named thesis.tex~ will be treated as a hidden file by window mangers such as GNOME and KDE.  It would generally be the backup version of the the document thesis.tex
- A shortcut for the previous directory. If you were in /home/username/directory and then you moved to  /home/username/Desktop, then the command 

cd -

will take you back to the previous directory: /home/username/directory
'text' Single quotes are strong quotes; nothing inside of them is treated as syntax to be interpreted/expanded. 

Example: If I issue the command

echo 'This command is a string. $SHELL and `whoami` will not be expanded'

the output is:

This command is a string. $SHELL and `whoami` will not be expanded

"text" Double quotes are weak quotes; commands enclosed in backquotes `command string` or $(command string) and variables $VARIABLE will be replaced inside of double quotes. 

Example: If I issue the command

echo "This command is a string. $SHELL and `whoami` will be expanded"

the output is:

This command is a string. /bin/bash and nathaniel will be expanded

 
`command`
< command < input_file  The file input_file will be fed into the program identified by the command
> command > output_file  The output if the command on the left will be sent to the file output_file rather than displaying in the terminal
| command1 | command2  Pipe output of command on the left into the input of the command on the right
>> command >> output_file  Append output of command to output_file rather than over-writing the file. Example
& Issuing the command 

command &

causes the program launched by command to run in the background.  The program will not exit when the shell is exited and the output of the program will not be visible in the shell.
&& command1 && command2  Run command2 if and only if command1 executes successfully Example:  
; Typing a semicolon in a command string is like pressing "enter" 
Example: typing

command1; command2; command3;

is equivalent to

command1
command2
command3

 

|| command1 || command2  Run command2 if and only if command1 does NOT execute successfully Example:  
[ ]
{ }
( )
$
(( ))
=
\
/
*
?
%

 

Commands and Programs:

Some of these commands may be specific to the Bourne Again Shell (bash)

help
man
apropos
whatis
ls
tree
pwd
echo
cd
mv
cp
rm
shred
rmdir
mkdir
ln
file
chmod
chown
getfacl
touch
chgrp
grep
awk
xargs
locate
find -name phrase
type (which)
whereis
cat
tac
rev
cut
split
csplit
less
more
head
tail
pr
fmt
fold
sed
vim
pico
wc
env
setenv
export
cmp
comm
diff
sdiff
bdiff
dircmp
uniq
rsync
sort
mutt
ssh
scp
sshfs hostname: mountpoint
byobu
screen
ping
wget
curl
tcp
dump
tar
gzip
gunzip
bc
fg
bg
alias
unalias
expr
eval
wait
if
else
for
until
while
case
continue
break
local
set
unset
function
seq
cksum
md5sum


Administrative tools:
su
sudo
fakeroot
chroot
top
mpstat
uptime
uname
ps
pgrep
pidof
kill
killall
who
users
w
date
passwd
adduser
addgroup
deluser
usermod
cron
crontab
ifconfig
route
free
df
du
lspci
lsdev
lsusb
lsmod
lsof
lshw
fdisk
parted
mount
umount
fsck
reboot
halt

undelete files
magicrescue:  www.itu.dk/people/jobr/magicrescue/
Image, video, PDF, and publishing tools
Packages:

Ghostscript, TeX Live, ImageMagick, FFmpeg, pdftk. 

Some utilities within these packages:

latex
bibtex
xetex
pdflatex
dvips
pdftops
pdf2ps
ps2pdf
ps2eps
pstopdf
eps2eps
epstopdf
convert
display
ffmpeg
pdftk

Development
A very small sample of programs that are available for free:

make
gcc
gdb
gprof
valgrind

Then there are programs that might not be extremely useful:

lynx - a text-based web browser
lpr - print a file from the command line
cal - a command line calendar