Home / Tech / operating system / Be Linux Termial Expert in Top 10 simple commands
linux-154766_640-e1470062878495
How to use Linux terminal?

Be Linux Termial Expert in Top 10 simple commands

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

Changing directory  [ cd ] & [ pwd ]

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

cd Home

And you are navigated in home, in case you want to go back to the previous directory it’s

cd ..

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

pwd

and to navigate in another folder simply type the URL path with forward slashes or from the root

cd /home/desktop
or Root path
cd /home/user/desktop

these are one and the same.

Listing command [ls]

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

ls

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

ls /home/Deskstop

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

ls -l

but the most important thing  listing command is used for, is viewing hidden folders which can be done by

ls -la

Copying , cutting and pasting renaming commands   [ cp ] [ mv ]

For an average person the most important thing that he does in computer in editing commands which can be achieved as

Copying

cp File path  destination file -v
 AS an example
cp /home/Desktop/file.txt /var/ -v

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.

 mv File path  destination file -v
 AS an example
 mv /home/Desktop/file.txt /var/ -v

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

 mv file.txt name.txt
and this will change file name to name and important always mention extension or your file will not open

Veiwing file commands [cat] [less]

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.

cat filename 

As examples, you have created a file name test you can see it contents like

cat test

or in less view like

less test

but if you want to exit “less” press q and you are back to same terminal command line.

Grabbing things up Grep command [ grep ]

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

cat test | grep src

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.

Echo print screen command [ echo ]

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

echo hey

and it prints hey in the terminal and if you want to add something to a file test then , this can be used as

echo hi > test

and hi is the test file

Creating new files, directories [ touch ] [ mkdir ] :-

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

touch file1 file2 file3

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

mkdir images

this will create the images  folder in pwd or you can give root path too and same applies for touch

Permission changing and Run mode changing command [chown] [chmod]

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

chown root:root test

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

chmod +x test

This will make test file executable you can make read-only by +r and writable as +w

Deleting files [ rm ]

This as stated can be used to delete file like example for test file

rm test

are you want to delete folder then

rm -r testfolder

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.

Getting help with commands and info [ man ] [–help]

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

cp –help

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

man cp

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 .

How passwords are hacked?Methods.

I hope you enjoyed the post.

have a great day.

About Harsh Nagarkar

Harsh Nagarkar is a budding blogger, His motto through this blog is to share knowledge about the things you can do through technology and life. His aim to help those who are looking for the answer in this world.

Check Also

super-productivity

7 Tech apps:Gigantically increase Your Productivity

Apps to increase Productivity | Everyone should have Top 7 tech apps that you must …

android-root

Best technique ever.Root phone without PC.

One Touch Android Root Hello there, So a lot of people nowadays don’t get time …

2 comments

  1. Nice post ,learned something new about Linux

Leave a Reply