Basic Linux Commands And Their Uses

Basic Linux Commands And Their Uses

·

2 min read

• what is Linux command?

Linux commands are a type of Unix command or shell procedure. They are the basic tools used to interact with Linux on an individual level. Linux operating system is used on servers, desktops, and maybe even your smartphone. It has a lot of command line tools that can be used for virtually everything on the system.

1 cat

The cat command is a utility command in Linux. One of its most common usages is to print the content of a file onto the standard output stream.

2 chmod

The chmod command in Linux is used to modify the permissions and access mode of files and directories. These are the permissions that control who can read, write and execute the file.

3 history

Linux history command is used to display the history of the commands executed by the user. It is a handy tool for auditing the executed commands along with their date and time.

4 rm

rm command is used to remove objects such as files, directories, symbolic links and so on from the file system like UNIX.

5 rm -r

The rm -r command in Linux is used to remove directories and their contents recursively.The rm stands for "remove."The -r option stands for "recursive," which means it will delete not only the specified directory but also all files and subdirectories within it.Be very careful when using this command, as it can permanently delete files and directories, and there is no easy way to recover them. Double-check the paths you specify to avoid unintentional data loss.

6 to create a fruites.txt file and to view the content.

  • vim fruits.txt

  • cat fruits.txt

7 Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.

• vim devops.txt

and add Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava one in each line.

To Show only top three fruits from the file.

• head -n 3 devops.txt

To Show only bottom three fruits from the file.

To create another file Colors.txt and to view the content.

• vim colors.txt

Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.

To find the difference between fruits.txt and Colors.txt file.

• diff fruits.txt colors.txt