Useful Linux Commands

Linux is an operating system – similar to Windows or Mac. It is freely available and very popular amongst researchers and programmers. Since many of the scripts you write will be run from the terminal, a list of popular Linux commands can be quite handy:

  • cd Used to change the directory (folder) which you have open. If I wanted to navigate to one of my directories I may write the command “cd /data/research/project”.
  • ls List the contents of a directory.
  • pwd Show the path to the current working directory.
  • mkdir This command followed by a name creates a directory.
  • rm Can be used to specify an empty directory or file you want to remove, for instance if you had a directory called ‘data’ you could delete it using “rm data”. If I wanted to delete all the files and directories in the directory “data”, I could use this command: “rm -rf data/*”.
  • tar –zxvf file.tar.gz Used to unzip a file.
  • chmod 777 filename.py Used to change the permissions on a file – this allows uses to read, write and execute this file.
  • sudo su – Enable root user privileges. You’ll be asked to input the root password if you issue this command.
  • cp firstname secondname Copy a file somewhere.
  • mv firstname secondname  Move a file and rename it.
  • ssh Log into another server using an SSH client through the terminal by inputting “ssh username@serveraddress”.
The following two tabs change content below.
Computational biology PhD candidate at the Australian National University. I love writing (both articles and software), learning more about the world around us, and beekeeping. I also write for BioSky.co

Latest posts by Jack Simpson (see all)

Comments are closed.