Command line is one of the most important things in Gnu/Linux world, all newbies should start to learning and knowing about that, so we wanna introduce some simple commands that may be good for starters.

Users enter commands in Terminal, Terminal is an application which provides you a place to command, this is a picture from a Terminal:

hossein@Lenovo: ~_002

Now let’s go to commanding, one of the most simple and practical commands is “echo”, this command will print things you want, first open your Terminal, In Ubuntu and some other distributions Terminal will be open with “Ctrl + alt + t” shortcut, as an example of “echo” command, enter this command in your Terminal:

Now you should have “This is JoinTUX!” printed in screen, just like this picture:

hossein@Lenovo: ~_002

 Well, may be “Echo” command is not really practical for start but it was just an example of how simple can command-line be, now let’s go through some practical commands that starters wanna know about, such as making, removing a directory, listing files and etc with command-line, “mkdir” will let you to create directory/folder in Terminal, as an example make a directory named “Test” in you /home/$USER:

Now check your user /home and there should be a folder as “Test”, but let’s check this from command line, so for checking that a file exists we can use “ls” command which will list our files within a directory,  so this command:

Note: $USER will put the name of your user there so you can also put the name itself too, for example “/home/hossein”, my user was hossein so I put “hossein” you can put you user there and $USER will find username and put there automatically!

The output of “ls /home/$USER” for me is like this:

As you can see there is a “Test” directory there so the directory has been made successfully! Now let’s see how we can remove the directory that we made, “mkdir” is a short form for “make directory” and “rmdir” is the command for removing a directory, “rmdir” is short form of “remove directory”, following command will remove the directory we made:

Now if you use “LS” command which you learned in this tutorial, the Test directory exists no longer in you user home.

You may like to know  how we can copy and move files with Terminal, “cp” command helps you to copy and “mv” will let you move/cut your files to another directory, let’s make a Test directory with “mkdir” and copy that in somewhere else, command below will make a Test directory:

Now let’s copy the file to “/home/$USER/Videos”, it goes like this:

Our file was in “/home/$USER” and we wanna send it to “/home/$USER/Videos”, so following command will do that:

Now let’s see how we can move the file again to /home/$USER, “mv” command is exactly like “cp” so:

Another command that is really vital to know is “cd” command, “CD” is short form for “change directory”, in fact when you are commanding commands will be executed in a directory, by default when you open Terminal it’s in your user home but if you wanna change it following command will help:

It’s so simple you just need to put your destination after cd and it will go there!

 “whoami” command will give you your username:

Now let’s make an empty text file with command line, touch command will help you to do that, look at the following command:

Command above will make an empty text file named “hello”, you can write something on it with “echo” command we learned so:

In command above “>” means write the output in the file which in this case file was “hello”,  now let’s see the text file with Terminal, “cat” command will show what has been written in Text files:

Now let’s see following pic and how it worked:

hossein@Lenovo: ~_003

It was just a simple start with command line, I wished you enjoyed!

LEAVE A REPLY

Please enter your comment!
Please enter your name here