First we will learn how to login for shell access. There are 7 terminals for Linux. 6 terminals are non - GUI and 1 terminal for GUI access. You can login to each terminal using Alt + Ctrl + F1 , F2, .. F7. Each terminals will request your username and password for login. If you want to use the shell in the graphical interface (GUI), press Alt + F2 and type "konsole". As a user you will have permission to access only your /home/user directory and other directories in it.
Now lets check out some commands:
| |
Listing contents in a directory - [ ls, ls -l, ll ] | |
| |
Reading files in Linux - [ cat, more, less ] | |
This command is used to display the contents of a file. You can read the file contents using the cat command. Example: [user@ws26 ~]$ cat testfile this is a test file.. You can read me.. Both the less and more commands serve similar function. They are used to display file one screen at a time. You can press spacebar to continue reading the file. These commands are mainly used while reading large files. Example 1: [user@ws26 ~]$ less testfile this is a test file.. You can read me.. Example 2: [user@ws26 ~]$ more testfile this is a test file.. You can read me.. | |
|
Manipulating files - [ cp, mv, rm, mkdir ] | |
This command is used to copy files/directory. Example: [user@ws26 ~]$ cp file1 directory1 This will copy the file1 into the directory1 This command is used to copy directories recursively (copy all the files and folders inside the directory). Example: [user@ws26 ~]$ cp directory2 directory1 This will copy the whole directory2 into directory1 This command is used to move the file or directory. Example: [user@ws26 ~]$ mv directory2 directory1 This will move the whole directory2 into directory1 This command is used to remove or delete files and directories. Example: [user@ws26 ~]$ rm directory2 This will delete the directory - directory2 This command is used to create a new directory Example: [user@ws26 ~]$ mkdir directory3 This will create a new directory - directory3. | |
create new file in Linux - vi editor | |
The Example:
| editor is mainly used to create new files in Linux. |
|