Bash command line for Linux - Cheat Sheet

Aug 05 2014

I’ve found these commands to be very useful but at the same time I can just as easily forget them. Therefore in this post I wanted to add a cheat sheet so I can refer back to it whenever I need to. These are the common ones I used the most


Useful commands

The Commands below are the ones I also find useful and need to use more. Learning to master grep is definitely one of my priorities.

Command Description
cat Concatenate and print (display) the content of files
chmod Change access permissions
df Display free disk space
echo Display message on screen
env Environment variables
eval Evaluate several commands/arguments
exit Exit the shell
grep Search file(s) for lines that match a given pattern
mkdir Create new folder(s)
passwd Modify a user password
pwd Print Working Directory
ssh Secure Shell client (remote login program)
su Substitute user identity
sudo Execute a command as another user
tail Output the last part of file
tar Store, list or extract files in an archive

Exploring and changing files

These commands are the commands I feel improves my workflow the most and overall productivity when working on a project. Easy to remember and definitely a good place to start for beginners

Command Description
ls List the files/folders in a directory
ls -la List all the files/folders in a directory (including hidden files) and displays additional information about them
cd pathname/directory/subdirectory To change directory
cd ../ To go up a level of a directory
cd ../../themes/images Or you can chain these commands together to navigate across directories
cp filename-to-copy.txt new-file-name.txt To copy a file with the same directory simply type
cp filename.txt ../../new-directory/filename.txt To copy between directories:
cp images/* ../skin/ To copy all files from one directory to another, use the * character, which unofficially means all
mv current-directory/file.txt ../new-directory/file Move a file
mv oldfilename.txt newfilename.txt To rename a file, use the ‘mv’ but change the name of the file when stating the directory receiving the file.
rm filename.txt To delete a file type
rm -r folder Alternatively if you wish to delete a directory, and all directories and files within that recursively, type
Written on August 5, 2014