How to use Linux terminal?
Top 10 basic commands
The world is getting more and more inclined towards technology , the Internet, and computers and as a matter of fact most of the internet and applicative industrial computers along with a great increase in Desktop computer for Linux.And to get acquaintance with Linux the most prominent thing to learn is Learning terminal and the basic set of commands so that you can learn rest of thing on your own.
Let’s move on the commands
This command is used for navigating up and down the hierarchy of folders , this is exact the same thing that is used in macintosh or windows, to use this as an example to open Home directory you would say in terminal
And you are navigated in home, in case you want to go back to the previous directory it’s
You can also go to a specific path but then you have to use it from present working directory or from root, to find your present working directory or in other words directory in which you are currently working is
and to navigate in another folder simply type the URL path with forward slashes or from the root
these are one and the same.
As the name says, this command is used for listing out the files or folders present in the current Directory to use this command navigate to any folder and use
Or if you want to see what inside a specific folder which is outside your present working directory you just need to type the path from root directory
there is some optimization for “listing” command like you can see the list of permission,file editing date and type on file by typing, this command which used for longlisting the items
but the most important thing listing command is used for, is viewing hidden folders which can be done by
For an average person the most important thing that he does in computer in editing commands which can be achieved as
then file.txt will get copied to /var/ directory but always keep in mind it is best practice to use -v (verbosity) to get result from terminal about where is it copied and is copying completed it is useful when you are copying big files like 20gb is it finished, crashed or going on in case your copying folder then -r option along with it, to be recursive.
Next, is cut pasting and renaming command, the syntax is same as copy command except mv,in case your copying folder then -r option along with it, to be recursive.
this will cut or move the file.txt to /var/ directory if you want to rename a file just put a name along with the extension in destination file and no path
There are 2 possible ways to view a file without running it, this saves you the risk of an unauthorized program running on your PC or even view a file but you don’t want to do any accidental changes.
The difference between cat command and less command is cat command shows data in terminal itself whereas less show data in new workspace in terminal, so if you are going to read a small file then cat is best for you and easy to access whereas if you going to read a huge file then you’re going to mess up with terminal sliding back and forth hence choose less command.
As examples, you have created a file name test you can see it contents like
or in less view like
but if you want to exit “less” press q and you are back to same terminal command line.
SO by headline you get it, this is actually very complicated command you can use it in many different ways, but this is mainly is used for grabbing things up for viewing.
For an example, you created a file name test and wrote in ” src: hey whats up,sbr: what you are doing” and run the following command to grabe a line with src in it , and then you want to view it
so what this implies cat to display data grabbed by grep command to show line containing src or you can use -I option to show everything except that line
And yes you can do much more stuff with grep I highly recommend reading man pages about it.
If you have never used the echo command it is used for echoing out literally meaning it will print what you say using echo, it is used like
and it prints hey in the terminal and if you want to add something to a file test then , this can be used as
and hi is the test file
If you want to create files quickly and fastly then touch is the one you are going to use. Any extension file can be created with touch command, this is used like
then this command will create file1 …. and so on.but you can create a single file too.
Next, if you want to create a directory or folder then you can use mkdir command it is used as
this will create the images folder in pwd or you can give root path too and same applies for touch
This intern is used for changing permission same as in windows we have administrative and normal user, same is over here.Chown command handles ownership and is used in such a way as an example you have a file name test then
This will set the file name test ownership to be of root user which from root group.Note there can be one or more user in root or other groups
Chmod command is used to set accessibility or run mode of the file, this is used whether to make a file read only,write only ,executable or all of these. It can be used for a file test
This will make test file executable you can make read-only by +r and writable as +w
This as stated can be used to delete file like example for test file
are you want to delete folder then
in this test folder was your directory but remember
This very dangerous command , to be used with caution the file deleted with rm command cannot be recovered unlike windows, if you delete something around in terminal ,you will sometimes possibly recover fragments.To be used with caution and never just enter rm command this will delete whole Linux directory and operating system.
These commands are used to get help for a command, for example, you want to know more regarding cp command then you can do so by typing
this will show all the option options available for the cp command, but this may not work for all commands
Every command in Linux has info page created , this can be read to understand that command , these pages are called man pages, this command can be used like
and it will display all the information regarding copy command from start to finish and even show who is the developer and who helped to create this command
These are the bare basic commands that you must know at beginner level .
I hope you enjoyed the post.
have a great day.