Have a Question?
Linux 101
The Linux Environment
The high performance computing clusters at UC, and at most institutions around the globe, use a distribution of Linux (Unix) as their operating system. Linux’s distributions are used due to their relatively small computational overhead, high customizability, and support for a wide selection of open source software. While some Linux distributions support Graphical User Interfaces (GUIs), most supercomputer user interact with the login cluster using a terminal interface. Below, we have compiled some training sources along with some command references to help users get started on a Linux environment.
Linux 101 workshop – slides
Linux 101 workshop – recording
Basic Linux commands
When logged into a Linux system through a terminal, you will be presented with a command prompt. Each user’s command prompt can be customized to their own specifications, but the default appearance is shown below.
[username@arcc]$
When a command is submitted, by pressing the “Enter” key, a new prompt will be created for the next command. With this in mind, in the following code examples, you will only need to type the text following the prompt into your own terminals to execute the commands.
Navigation commands
pwd: present working directory; what directory am I sitting in.
[username@arcc]$ pwd
/home/username
ls: lists the contents present in the current directory
[username@arcc]$ ls
folder1 folder2 folder3
cd: Use this command to go to a directory. For example, if you are in the home folder, and you want to go into folder1, then you can type in “cd folder1”. To go back from a folder to the folder before that, you can type “cd ..” .
[username@arcc]$ pwd
/home/username
[username@arcc]$ ls
folder1 folder2 folder3
[username@arcc]$ cd folder1
[username@arcc]$ pwd
/home/username/folder1
File and folder manipulation commands
mkdir: Use this command when you need to create a folder or a directory.
[username@arcc]$ mkdir folder4
[username@arcc]$ ls
folder1 folder2 folder3 folder4
touch: this is used to create a new empty file.
[username@arcc]$ touch file1
[username@arcc]$ ls
folder1 folder2 folder3 folder4 file1
rm: rm is used to delete a specific file.
[username@arcc]$ rm file1
[username@arcc]$ ls
folder1 folder2 folder3 folder4
rm -r folder will delete a folder
cp: cp is used to copy a file from one folder to another through the command line.
[username@arcc]$ cp Alpha /opt/ohpc
This copies the file Alpha to the directory /opt/ohpc)
mv: move a file from one directory to another. Can also be used to rename files. Syntax for use is similar to cp.
Text Editors
- VI (VIM)
- Available on most Linux systems.
- Utilizes “modes” for interaction
- See our Intro to VIM article
- Nano
- Easiest to use but not always available.
- Menu at the bottom of the screen.
- Use control-x (^x) to exit.
External Resources
The following web pages contain further information regarding:
Linux Navigation
Linux Folder and File Manipulation
The VI test editor
The Nano text editor
i