Why Linux Commands Matter
Linux commands are reason behind the popularity of Linux operating system. Also it’s a operating system which is used in super computers to smart phones. So, having a working knowledge about Linux operating system is a great skill to have. Therefore it’s a mandatory skill for system administrator, network engineers, IT specialist, security analyst, cloud experts and many other types of professionals. So spending your time to learn Linux is actually a long-term investment.
If you haven’t installed Linux in your computer, then you should follow this link. There you will get a elaborated instructions on how to setup Linux in your computer. And after finishing Linux installation part, you are ready to go!
01. Complete offline manual
First Linux command we will see is man. It is a short form of manual. You don’t have to have internet connection or anything else to use this command. If you want to know about any commands, simply type man and then the command. For example, you want to know about the command ls. Then type man ls like below.
[daredevil78@localhost ~]$ man ls
After typing above command, you will get a detailed manual for the command ls. You can scroll through the manual for reading more.
Now suppose you don’t know the command you are looking for, then what you will do? Again you can use man command with -k parameter. -k is the short form of keyword. Suppose you want to see the available commands related to password. Then you can type
[daredevil78@localhost ~]$ man -k password.
This Linux command will show you all the available command related with password.
And if you want to know what man command can do, then type
[daredevil78@localhost ~]$ man man
02. Navigating Around Linux
In Linux system folders are called directory. If you want to move from one directory to another directory, then command is simple. It is cd. cd is the short form of change directory. You have to type cd and directory name.
[daredevil78@localhost ~]$ cd daredevil
If you type the above command, you will go to the directory named daredevil.
Now, if you want to go to one directory up, you have to type
[daredevil78@localhost ~]$ cd ..
If you want to go few directories up, then type
[daredevil78@localhost ~]$ cd ../../
And again, you can type [daredevil78@localhost ~]$ man cd to know about this Linux command in details.
03. Know your current location
Before navigating Linux file system, its better to know your present directory. There is a very useful command for this purpose. pwd, which is a short form of present working directory shows your current directory.
[daredevil78@localhost ~]$ pwd/home/daredevil78
04. Listing files and directories
After going to desired directory, you may want to see the files or contents of that directory. For that purpose you can use one of the shortest command, ls. ls is the short form of list. This command will list every file and directories of current directory.
[daredevil78@localhost ~]$ ls
There are many parameters you can use with ls commands. Few of them are listed below.
[daredevil78@localhost ~]$ ls -a – shows hidden files and directories. [daredevil78@localhost ~]$ ls -R – shows files and directories recursively.
Below command will show long listing of directories with many information.
[daredevil78@localhost ~]$ ls -l
If you want information about a particular file or files with same pattern, then enter the commands below.
[daredevil78@localhost ~]$ ls -l file_name – shows information about file_name file. [daredevil78@localhost ~]$ ls -l my?script – shows information about files matches given pattern. [daredevil78@localhost ~]$ ls -l my* – shows information about files start with my.
05. Creating Files
In many cases, you have to create new files. For that you can use touch command with file name. If defined file name already exists, then its modification time will be changed.
[daredevil78@localhost ~]$ touch daredevil
06. Copying files
Copying files is one of the most common task you will do frequently. For copying a file the command is cp. cp stands for copy. cp command takes two argument at least. First one is source file and its location. Second command is destination for copied file.
[daredevil78@localhost ~]$ cp old_file new_file
Above Linux command will copy the old_file as new_file.
You can use many parameters with cp command. Some of them are explained below.
[daredevil78@localhost ~]$ cp -i source destination – asks before overwriting at destination. [daredevil78@localhost ~]$ cp -R source/ destination – copies everything of source to destination.
07. Renaming files
If you want to change a file’s name or move it to a different directory, then mv is your command.
[daredevil78@localhost ~]$ mv fill fall – renames fill file to fall file. [daredevil78@localhost ~]$ mv Scripts Old_Scripts – renames Scripts directory to Old_Scripts.
08. Deleting files
In Linux system, deleting a file or directory is done by rm command. You can use various parameter with this Linux command.
[daredevil78@localhost ~]$ rm -i fall – removes fall file with confirmation. [daredevil78@localhost ~]$ rm -ri tamal – descends into tamal dir, removes file, then removes dir.
09. Viewing File’s content
To view a files content without opening it, you can use less command. Though it is called less, but it has many features. All you have to type less and desired file name.
[daredevil78@localhost ~]$ less log.txt
Above command will show you the contents of log.txt file without opening it in any text editor.
The beauty of Linux operating system is you can perform a task in many ways. Above commands are easiest yet powerful. But there are many other Linux commands which you can use to achieve the same output. So, do you know any easy and effective Linux commands except these? Please share with us in comments. Thank you all!
Leave a Reply