Click ⭐if you like the project. Pull Request are highly appreciated. Follow me @SudheerJonna for technical updates.
No. | Topic |
---|---|
1 | User information |
2 | File and directory commands |
3 | File permissions |
4 | Networking |
5 | Installing packages |
6 | Disk usage |
7 | System and Hardware information |
8 | Search Files |
9 | SSH |
10 | Vi/Vim-commands |
-
who It is used to get information about currently logged in user on to system
$ who sudheer :0 2019-08-04 01:21 (:0)
- whoami: It display the system’s username
$ whoami sudheer
- id: It display the user identification information
$ id
-
pwd The pwd(Present Working Directory) command is used to print the name of the present/current working directory starting from the root.
$ pwd /home/sj/Desktop/Linux
-
mkdir The mkdir(make directory) command allows users to create directories or folders.
$ mkdir ubuntu $ ls ubuntu
The option '-p' is used to create multiple directories or parent directories at once.
$ mkdir -p dir1/dir2/dir3 $ cd dir1/dir2/dir3 ~/Desktop/Linux/dir1/dir2/dir3$
-
rm: The rm(remove) command is used to remove objects such as files, directories, symbolic links etc from the file system.
- Remove file: The rm command is used to remove or delete a file
rm file_name
- Remove file forcefully: The rm command with -f option is used for removal of file without prompting for confirmation.
rm -f filename
- Remove directory: The rm command with -r option is used to remove the directory and its contents recursively.
rm -r myDir
- Remove directory forcefully: The rm command with -rf option is used to forcefully remove directory recursively.
rm -rf myDir
-
touch: The touch command is is used to create, change and modify timestamps of a file without any content.
- Create a new file: You can create a single file at a time using touch command. The file created is an empty file.
touch file_name
- Create multiple files: You can create the multiple numbers of files at the same time.
touch file1_name file2_name file3_name
- Change access time: The touch command with
a
option is used to change the access time of a file.
touch -a file_name
- Change modification time: The touch command with
m
option is used to change the modified time.
touch -m file_name
- Use timestamp of other file: The touch command with
r
option is used to get timestamp of another file.
touch -r file2 file1
In the above example, we get the timestamp of file1 for file2. 6. Create file with Specific time: The touch command with 't' option is used to create a file with specified time.
touch -t 1911010000 file_name
-
cat: The cat command is used to create single or multiple files, view contain of file, concatenate files and redirect output in terminal or files.
- View file contents: You can view contents of a single or more files by mentioning the filenames.
cat file_name1 file_name2
Vi editor is the most popular text editor from the early days of Unix. Whereas Vim(Vi IMproved) is an improved version of vi editor to be used in CLI (command line interface) for mainly text editing tasks in many configuration files. Some of the other alternatives are Elvis, Nvi, Nano, Joe, and Vile. It has two main operation modes,
- Command Mode: It allows the entry of commands to manipulate text.
- Entry mode(Or Insert mode): It allows typed characters on the keyboard into the current file.
You can create a new file or open an existing file using vi filename
command.
vi <filename_NEW> or <filename_EXISTING> // Create a new file or open an existing file
Example:
vi first.txt
Let's see how do you create file, entre the content and leave the CLI by saving the changes.
- Create a new file named
first.txt
- Press
i
to enter the insert mode - Enter the text "Hello World!"
- Save the text and exit by pressing
:wq!
command - Check the entered text
These commands will be used in Command mode.
You can use arrow keys(left, right, up and down) to move the cursor on the terminal. But you can also other keys for this behavior.
h # Move left
j # Move down
k # Move up
l # Move right
These commands used to jump one word at a time
w # Jump forwards to the start of a word
W # Jump forwards to the start of a WORD
e # Jump forwards to the start of a word
E # Jump forwards to the start of a WORD
b # Jump backwords to the start of a word
B # Jump backwords to the start of a WORD
These commands used to move starting or ending of a line.
^ # Jump to the start of a current line
$ # Jump to the end of a current line