<< Back to Blog

Linux Command-line Cheatsheet

This is a simple cheat sheet for moving around a linux file structure that I created for a few friends that were just learning the Linux Command-line. These are basic, everyday commands that you will probably use the most often for moving around the file structure and adding/removing/changing files.


Changing directories:



Go to your current user’s home directory. So, if that is ‘/home/someuser’, ‘cd ~’ takes you to that directory. It is just a shortcut.

$cd ~


Takes you to the directory you were previously in.

$cd ..


Shows the present working directory (the directory you are currently in).



Remove/delete a file. (Warning: Be very careful with this, there is no undo and no Trash Bin/Recycling Bin. Recovering from this is not a simple task.)


Remove/delete a directory and everything in it. (Same warning as above.)
$rm -r


Create (make) a directory.


Opens up a new file in the VIM text-editor. (See my VIM Crash Course post.)


Open test.html in VIM.
$vim test.html


List directory contents.


List directory contents in a list-view.
$ls -l


Show the contents of a file in the terminal screen without actually opening it.
$cat filename