Basic commands used on linux terminal part 1
In this blog, I am going to introduce the beginners with the basic but very important few commands of Linux.
Usually most of the users come to Linux for one of two reasons. One they are sick of viruses or they want to experiment on other operating system like Linux. Whatever the reason is for any beginner it is necessary to understand the use of a particular operating system and the way it works. We can use Linux in graphical mode too. But CLI is the best feature of linux. We call the CLI as terminal. Until now terminal is known as the strongest software. Let’s know about some basic commands on Linux terminal.
- ls – Known as list. This command used for listing members of a directory. It also lists the properties of the member of directory. It has helpful manual where we are able to see its different parameters. Some of the parameters are used to see the selinux context of a particular file or even of a folder.
example: #ls /home - Cd – Known as change directory. it has a very short manual. there are only 2 perameters for this command. the parameters are L and P. the default is L.
example: #cd /home - touch – Known as change file timestamps. This is one of the most commonly used commands on linux terminal. it has a verity of parameters. It changes the time properties of file during creation or modification.
example: #touch file.c - Cp – known as copy. In this command we have to provide two arguments. one is source and another is destinaiton. there are several parameters we can have. but mostly used parameter is “r” this “r” means recursive.
example: #cp /var/log/message /home
- Mv – known as move. this command will move the file from its source to destinatin. the parameters are same as copy.
example: #mv /var/log/message /home - rm – known as remove. this command is a very risky command on linux terminal. we should use this command very carefully. we can use this command to remove anything from the system. usually we use a force (-f) to delete without asking and a recursive (-r) so that it deletes everything. but again we should use this very carefully.
exapmle: # rm /home/message - mkdir – known as make directory. The use of this command is just to create new directory from CLI. Usually we use the straight command but if we need to create a directory into another directory we have to use a parameter –p.
example: mkdir test or mkdir –p /home/test - rmdir – known as remove directory. this command removes a directory by using terminal. but if the directory is not empty then it will not be removed unless you use force as parameter.
example: #rmdir /home/test - cat – known as concatenate. This is a very common command in linux. This command uses for viewing the content of a file. It can only read the plain text.
example: cat /home/file.txt - more & less – these two commands actually do the same work. both are usually used for viewing a append content. these commands are mostly used on viewing system and service log files. both of those have few very good features. like we can view a particular number of lines in case of more and in case of less we can see from a particular line from that file. also both have the search feature from a continues text append file. the parameter are usually –n, -f, -number, +/word to search etc. details will be discussed on future post.
example: more /var/log/message & less /var/log/message
on next few posts we will discuss about the commands for a clear view. The main goal to post these commands is to know the commands and there uses. So that when we start working on the advance level, we can understand why we used that particular command.