<< 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:

$cd

 

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).

$pwd

 

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.)
$rm

 

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

 

Create (make) a directory.
$mkdir

 

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

 

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

 

List directory contents.
$ls

 

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