SYSTEM INFO
calShow this month's calendar. cal month year to see specific month and/or year (you can leave out either one). ncal shows calendar in a different format
dateShow the current date and time. The format can be changed in multiple ways - e.g. date +%Y-%m-%d (see man page for date command for more info)
uptimeShow current uptime
wShow who is logged on and what they are doing
whoamiPrint effective userid (=which am I?)
finger usernameDisplay information about username. Please notice that package finger seldom comes by default in distros
uname -aShow kernel information
df -hReport file system disk space usage in human readable -h format
cat /proc/cpuinfoCPU information
cat /proc/meminfoMemory information
du -h -d2Show directory space usage in human readable -h format with depth -d of two directories
free -mShow memory and swap usage in MB - output can be in formated with -b (Bytes), -k (KiloBytes), -m (MegaBytes) and -g (GigaBytes)

KEYBOARD SHORTCUTS
Show the previous command
Ctrl + RAllows you to type a part of the command you're looking for and finds it
Ctrl + ZStops the current command, resume with fg in the foreground or bg in the background
Ctrl + CHalts the current command, cancel the current operation and/or start with a fresh new line
Ctrl + LClear the screen
command | lessAllows the scrolling of the bash command window using Shift + and Shift +
!!Repeats the last command
! numRepeats the command num - run command history to see listing of runned commands (numbered)
!stringRefer to the most recent command starting with string
!?string?Refer to the most recent command containing string
command !$Repeats the last argument of the previous command
Esc + . (a period)Insert the last argument of the previous command on the fly, which enables you to edit it before executing the command
Ctrl + AReturn to the start of the command you're typing
Ctrl + EGo to the end of the command you're typing
Ctrl + UCut everything before the cursor to a special clipboard, erases the whole line
Ctrl + KCut everything after the cursor to a special clipboard
Ctrl + YPaste from the special clipboard that Ctrl + U and Ctrl + K save their data to
Ctrl + TSwap the two characters before the cursor (you can actually use this to transport a character from the left to the right, try it!)
Ctrl + WDelete the word / argument left of the cursor in the current line
Ctrl + DLog out of current session, similar to exit

FIND COMMANDS
apropos subjectList manual pages for subject
man -k keywordDisplay man pages containing keyword
man commandShow the manual for command
man -t man | ps2pdf - > man.pdfMake a pdf file, man.pdf, of a man command manual page
which commandShow full path name of command
time commandSee how long the command takes to execute
whereis appShow possible locations of app
which appShow which app will be run by default; shows the full path

SEARCHING
grep pattern filesSearch for pattern in files
grep -r pattern dirSearch recursively dir for pattern in dir
command | grep patternSearch for a pattern in the output of a command
locate fileFind all instances of file
find / -name filenameStarting with the root directory, look for the file called filename
find / -name ”*filename*”Starting with the root directory, look for the file containing the string filename
locate filenameFind a file called filename using the locate command; this assumes you have already used the command updatedb (see next)
updatedbCreate or update the database of files on all file systems attached to the Linux root directory
which filenameShow the subdirectory containing the executable file called filename

FILE PERMISSIONS
chmod octal filenameChange the permissions of file(or directory for that matter) to octal value, which can be found separately for user, group, and world by adding: 4 - read (r), 2 - write (w), 1 - execute (x). Instead of octal, letters can be used also for user/group (u is for user, g is for group, a is for all and o is for others) and for rights (r is for read, w is for write, x is for execute permission). For more options, see man chmod - Examples:
chmod 777 filename - read, write, execute for all. Same as chmod a+rwx filename
chmod 755 filename - rwx for owner, rx for group and world. Same as chmod u+rwx, g+rx filename
chmod --reference=file1 file2Change a file permission to same as another file. In this example, file2′s permission will be set exactly same as file1′s permission.
chown -R user:usergroup /some/pathGrant permissions recursively to user:usergroup to directory /some/path

FILE COMMANDS
lsDirectory listing
ls -lList files in current directory using long format
ls -laCList all files in current directory in long format and display in columns
ls -FList files in current directory and indicate the file type
ls -alFormatted listing with hidden files
cd dirChange directory to dir
cdChange to home - equivalent to cd ~
cd ..Change to dir one step towards root / dir
cd -Change back to previous directory
mkdir dirCreate a directory dir
mkdir -p /dir/to/something/newBy adding a -p to the mkdir, the command automatically generates all the parents for the new directory
pwdShow current directory
rm nameRemove a file or directory called name
rm -r dirDelete directory dir
rm -f fileForce remove file
rm -rf dirForce remove an entire directory dir and all it’s included files and subdirectories (use with extreme caution)
cp file1 file2Copy file1 to file2
cp -r dir1 dir2Copy dir1 to dir2; create dir2 if it doesn't exist
cp file /home/dirnameCopy the file called filename to the /home/dirname directory
mv file /home/dirnameMove the file called filename to the /home/dirname directory
mv file1 file2Rename or move file1 to file2; if file2 is an existing directory, moves file1 into directory file2
ln -s file linkCreate symbolic link link to file
touch fileCreate or update file
cat > filePlaces standard input into file
cat fileDisplay the file called file
more fileDisplay the file called file one page at a time, proceed to next page using the spacebar
head fileOutput the first 10 lines of file
head -20 fileDisplay the first 20 lines of the file called file
tail fileOutput the last 10 lines of file
tail -20 fileDisplay the last 20 lines of the file called file
tail -f fileOutput the contents of file as it grows, starting with the last 10 lines. Can be shortened to tailf on most *nix

COMPRESSION
tar cf file.tar filesCreate a tar named file.tar containing files
tar xf file.tarExtract the files from file.tar
tar czf file.tar.gz filesCreate a tar with Gzip compression
tar xzf file.tar.gzExtract a tar using Gzip
tar cjf file.tar.bz2Create a tar with Bzip2 compression
tar xjf file.tar.bz2Extract a tar using Bzip2
gzip fileCompresses file and renames it to file.gz
gzip -d file.gzDecompresses file.gz back to file

PRINTING
service cups startStart the cups print daemon. Other options are status and stop
lpqDisplay jobs in print queue
lprmRemove job(s) from queue. See man page for options
lprPrint a file
lpcPrinter control tool
man subject | lprPrint the manual page called subject as plain text
man -t subject | lprPrint the manual page called subject as Postscript output

NETWORK
ifconfigList IP addresses for all devices on the local machine
ping hostPing host and output results
whois domainGet whois information for domain
dig domainGet DNS information for domain
dig -x hostReverse lookup host
wget filenameDownload file
telnet foobar.com 80See if port 80 is open on server foobar.com
traceroute foobar.comPrint the route packets trace to network host
mtr foobar.comTraceroute on steroids (combination of traceroute and ping) with better statistics

SSH
ssh user@hostConnect to host as user
ssh -p port user@hostConnect to host on port port as user
ssh-copy-id user@hostAdd your key to host for user to enable a keyed or passwordless login

USER ADMINISTRATION
adduser usernameCreate a new user username
passwd usernameGive username a new password
suLog in as superuser from current login
exitExit from current useraccount and revert to previous user

PROCESS MANAGEMENT
psDisplay your currently active processes
topDisplay all running processes
kill pidKill process id pid
killall procKill all processes named proc (use with extreme caution)
bgLists stopped or background jobs; resume a stopped job in the background
fgBrings the most recent job to foreground
fg nBrings job n to the foreground

INSTALLATION
./configure; make; make install
dpkg -i pkg.debInstall a DEB package (Debian / Ubuntu / Linux Mint)
rpm -Uvh pkg.rpmInstall a RPM package (Red Hat / Fedora)

STARTING AND STOPPING
shutdown -h nowShutdown the system now and do not reboot
haltStop all processes - same as above
shutdown -r 5Shutdown the system in 5 minutes and rebootshutdown -r now – Shutdown the system now and rebootreboot – Stop all processes and then reboot - same as above
startxStart the X system