Pegasus IV Cluster |
|||||||||||||||||||
|
Linux basics
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 www.linux.org. The Linux shell tutorial offered at http://www.linuxcommand.org 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 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.
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:
The ls command has a lot of different switches (try "man ls"), but particularly useful is
which will return a much more detailed file list,
Change directory
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 "/".
will take you to the parent directory, while
will automatically return you to your home directory. To remove a file use
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:
from its parent directory. Note that the directory you want to remove has to be empty. To copy a file, type:
This will copy a file <source> to the <destination> location. If you just want to move a file to a different directory, use
mv can also be used to rename a file:
will rename <file_name_1> to <file_name_2> To see contents of a text file you can use various tools such as:
and
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. Typing
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. |