For a good linux tutorial, you can see the Software Carpentry Course [here] (https://swcarpentry.github.io/shell-novice/).

Here is a cheat sheet of unix/linux commands that are good to know:

1 File Navigation and Management

  • ls — list items in current directory.

  • ls -ltr — list items in current directory and show in long format to see permissions, size, and modification date.

  • ls dir — list all items in directory dir.

  • cd dir — change directory to dir.

  • cd .. — go up one directory.

  • cd / — go to the root directory.

  • cd ~ — go to to your home directory.

  • cd - — go to the last directory you were just in.

  • pwd — show present working directory.

  • mkdir dir — make new directory called dir.

  • rm file — remove file.

  • rm -r dir — remove directory dir recursively.

  • cp file1 file2 — copy file1 to file2.

  • cp -r dir1 dir2 — copy directory dir1 to dir2 recursively.

  • scp file1 location - secure copy one file to the cluster.

  • mv file1 file2 — move (rename) file1 to file2.

  • mv file1 ~/file1 — move file1 from the current directory to user’s home directory.

  • cat file — output the contents of file.

  • less file — view file with page navigation.

  • head file — output the first 10 lines of file.

  • tail file — output the last 10 lines of file.

  • tail -f file — output the contents of file as it grows, starting with the last 10 lines.

  • nano file — edit file using nano text editor.

2 System

  • ssh - secure shell, allows you to communicate with another machine.

  • shutdown — shut down machine.

  • reboot — restart machine.

  • exit — exit terminal session.

  • date — show the current date and time.

  • whoami — who you are logged in as.

  • man command — show the manual for command.

  • df — show disk usage.

  • du — show directory space usage.

  • free — show memory and swap usage.

  • whereis app — show possible locations of app.

  • which app — show which app will be run by default.