The touch command in Linux:

To make a new file, you can use the touch command. Just type “touch” and then the name you want for your file. This will create the file right here in the folder.

root@ubuntu:~# touch <file name>

In command in Linux:

To create a link to another file, we use the ln command. This is one of the important Linux commands that you should know if you’re planning to work as a Linux administrator

root@ubuntu:~# ln -s <source path> <link name>

The cat, echo, and less commands:

When you want to output the contents of a file, or print anything to the terminal output, we make use of the cat or echo commands.

root@ubuntu:~# cat <file name>
root@ubuntu:~# echo <Text to print on terminal>

The less command is used when the output printed by any command is larger than the screen space and needs scrolling.

root@ubuntu:~# cat /boot/grub/grub.cfg  

The main command in Linux:

The man command is a very useful Linux command you must know. When working with Linux, the packages that we download can have a lot of functionality.

root@ubuntu:~# man <command>

Uname and whoami command in Linux:

The uname and whoami commands allow you to know some basic information which comes really handy when you work on multiple systems.

root@ubuntu:~# uname -a

Tar,zip and unzip command in Linux:

The tar command in Linux is used to create and extract archived files in Linux. We can extract multiple different archive files using the tar command.

#Compress
root@ubuntu:~# tar -cvf <archive name> <files seperated by space>
#Extract
root@ubuntu:~# tar -xvf <archive name>

the first line, we created an archive named Compress.tar with the New-File and New-File-Link. In the next command, we have extracted those files from the archive.

root@ubuntu:~# zip <archive name> <file names separated by space>
root@ubuntu:~# unzip <archive name>

The Grep command in Linux:

search for a specific string within an output, the grep command comes into the picture. We can pipe (|) the output to the grep command and extract the required string.

root@ubuntu:~# <Any command with output> | grep "<string to find>"

The Head and Tail Commands in Linux:

the head and the tail commands come in handy. file named “Words” with a lot of words arranged alphabetically in it. The head command will output the first 10 lines from the file, 

root@ubuntu:~# head <file name>
root@ubuntu:~# tail <file name>

 the head command showed 10 lines from the top of the file.

The tail command outputted the bottom 10 lines from the file.

Leave a Reply

Your email address will not be published. Required fields are marked *