Contact Contact Us
Contact Us

Linux Basics

Intro

Our cluster uses CentOS currently, so all commands shown here will be specific to CentOS. Most commands across Linux distros are the same, but there are a few commands that diverge. If you already know Linux, this manual will not be important. Nothing specific to our HPC will be in here, it will be only basic Linux commands.

Folders and Moving Around

At the core of all modern computers is a file system, and high-performance computing is no exception. Every user also has their own home directory (that's a fancy way of saying 'folder'). This home directory is where you, as a user of our HPC, will be able to keep all of your files. There are a few commands that you'll be using fairly often when using Linux through a terminal:

  • - cd 'directory name' - This command takes you to a specific directory
  • - cd .. - This command takes you up one level in the folder heirarchy
  • - cd ~ - This command takes you to your home directory. ~ is just shorthand for your home directory.
  • - ls - Lists the contents of the directory you are currently in. Passing the -a flag will let you see all hidden folders/files.
  • - mkdir 'directory name' - Creates an empty directory with the name you pass in.

Manipulating Data

Now that we know how to create folders and move around them, the next logical step is knowing commands that allow us to populate those folders with data.

  • - cat 'file name' - Shows all the contents of a file
  • - touch 'file name' - Creates an empty file with the name you pass in.
  • - mv 'file name' 'new file name' - Moves file to new file name. This is basically just a file rename, but this can be used to move files to different folders too.
  • - rm 'file name' - Removes the file. Use the -r flag to remove directories.
  • - cp 'file name' 'new location' - Copies the file to a new location. Will not destroy the old file.

Finding Data

Usually ls and cat are sufficient for finding data through the terminal, but there are a few tools that allow us to find data even more efficiently. The commands will be listed below, but there will also be a dedicated tutorial on their use as well.

  • - find 'file name' - Searches through the system for that specific file. It's slow, but if your file exists, it will be found.
  • - locate 'file name' - Uses an already indexed version of the file system to find a file. If your file hasn't been indexed yet, it won't be found, but locate is very fast.
  • - grep - Finds a certain charcter sequence in a given output. Again, these commands will have a dedicated tutorial as they can be a bit complex.