Pegasus IV Cluster

Pegasus Home
Diskless clusters

Thomas Vojta
Research Group
Physics Department


Linux basics

Up Linux basics Serial jobs Parallel jobs

This page obviously only scratches the surface of the Linux operating system. If you desire to learn more, consult one of the many books on Linux or online tutorials such as those offered at The Linux shell tutorial offered at may be particularly useful.

In contrast to Windows, physical drives (hard disks, DVD drives, etc) are somewhat hidden from the user in Linux There is a single hierarchical directory tree which starts at root '/'. Different partitions or physical devices are mounted as subdirectories of '/'. Each user has a home directory under /home which is named after the user, e.g., user john will have home directory /home/john.

When you log into pegasus4 you will find yourself in your home directory. You should see something like:

[user@pegasus4 ~]%

user stands for your user name, and pegasus4 is the name of the machine you are logged into.

~ is a universal abbreviation for the home directory. For user john ~ is equivalent to /home/john

% sign designates the end of the prompt.

Note: Not all Linux systems will have the same command prompt. Default prompt may be as simple as a single '$' sign. As pretty much with everything under Linux, you have a lot of freedom to adjust the command prompt as it suits you. If you use tc/c shell, the place to look for the definition of your command prompt is ~/.cshrc

Man pages

Before we start listing basic command for creating, deleting, copying... of files and directories, it is useful to know how to get help when you need it.

man <command>

will give you (usually) detailed description of the <command> with all possible command line switches. So, "man cp" will give show you how to use cp command to copy files and directories, "man rm" will teach you how to use rm command to delete files (you should read this one!!!), "man man" will tell you how to use "man".  Do not be lazy, read manuals, it will save you a lot of headache on a long run!


Basic Linux commands

The wildcard symbol "*" means any number of any characters, while "?" will mach any single character.

List directory content. The command


will return the contents of current directory; for example:

[vojtat@pegasus4 atbench2014]%ls
a.out atbench2014.txt cfco0200.dat cfen0200.dat cfma0200.dat
atbench2014.f90 atbench2014.txt.bak cfco0200.ori cfen0200.ori cfma0200.ori

The ls command has a lot of different switches (try "man ls"), but particularly useful is

ls -la

which will return a much more detailed file list,

[vojtat@pegasus4 atbench2014]%ls -la
total 956
drwxr-xr-x. 2 vojtat users 4096 Nov 23 11:25 .
drwxr-xr-x. 10 vojtat users 4096 Nov 23 11:06 ..
-rwxr-xr-x. 1 vojtat users 877914 Nov 23 11:23 a.out
-rw-r--r--. 1 vojtat users 54682 Aug 8 18:43 atbench2014.f90
-rw-r--r--. 1 vojtat users 1338 Nov 2 16:19 atbench2014.txt
-rw-r--r--. 1 vojtat users 1240 Nov 2 16:16 atbench2014.txt.bak
-rw-r--r--. 1 vojtat users 2010 Nov 23 11:26 cfco0200.dat
-rw-r--r--. 1 vojtat users 2010 Aug 8 18:46 cfco0200.ori
-rw-r--r--. 1 vojtat users 1531 Nov 23 11:26 cfen0200.dat
-rw-r--r--. 1 vojtat users 1531 Aug 8 18:46 cfen0200.ori
-rw-r--r--. 1 vojtat users 2667 Nov 23 11:26 cfma0200.dat
-rw-r--r--. 1 vojtat users 2667 Aug 8 18:46 cfma0200.ori

Change directory

cd <dir name>

will put you into directory with the name <dir name>. Note that you can specify paths both relative to the current directory and absolute, starting from "/".

cd ..

will take you to the parent directory, while

cd ~

will automatically return you to your home directory.

To remove a file use

rm <file name>

Be careful, by default, "rm" will not ask for the conformation, it will just remove the file. It is wise to use "-i" switch which will force "rm" to ask for a conformation. If nothing else, at least read manual pages on rm. For a Linux infant "rm" can be quite dangerous command. Be careful!!!

If you want to remove a whole directory, type:

rmdir <dir_name>

from its parent directory. Note that the directory you want to remove has to be empty.

To copy a file, type:

cp <source> <destination>

This will copy a file  <source> to the <destination> location.

If you just want to move a file to a different directory, use

mv <source> <dest>

mv can also be used to rename a file:

mv <file_name_1> <file_name_2>

will rename <file_name_1> to <file_name_2>

To see contents of a text file you can use various tools such as:




If you are used to file managers like the famous old Norton Commander or Total Commander for Microsoft Windows, you may find Midnight Commander useful. It also provides basic file viewing and editing capabilities.



will open Midnight Commander which looks like this:

Note: To get the correct representation of Midnight Commander's line drawing characters in PuTTy, set the character set to UTF-8 and the handling of line drawing characters to Unicode.