banner image
Sedang Dalam Perbaikan

Basic Linux Commands






Linux is an OS which uses its terminal frequently unlike Windows. If someone is going to become a Linux user, some basic commands are needed to be practiced. This article is based on such commands which are used frequently when you are using Ubuntu. These are basic commands. Without them you will not able to use Linux in a different way. Try to use them and increase your skill and interest to use Linux terminal. It will be  very interesting. Let's move on to them.


  • pwd  -  Show current directory
  • ls  -  List the files in the folder you re already in
  • ls -l  -  List files in current directory using long format with more details
  • cd directory_name  -  Change to the given directory
  • cd  ..  -  Go back one step folder wise
  • cd  -  Change to home
         As  an example  I will navigate to my downloads directory. 
        You can see the below screenshot to get to know what's going on with the particular cd  commands.


  • mkdir directory_name  -  Create a directory called directory_name
  • touch file_name  -  Create a file called file_name


VI Commands


  • vi file_name  -  Edit the file
When you hit vi file_name, you will get the chance to edit the file via terminal. To use it press "i" key. Then you are in insert mode and you can type in terminal that you want to include in the file   you selected. If you want to switch to console mode; (in that mode you can not edit the file) press "Esc" key. After that type ":wq" to save and quit from the file.


Editing and saving the file
Opening the saved file

There are several command used when editing the files. Those are shown below.



The following commands can be used when you are in console mode to manage the content of file.



  • rm -r directory_name  -  Delete directory called directory_name
  • rm -f file -  Force remove file in the directory. You have to go in the directory by cd command.
  • rm -rf directory_name -  Force remove entire directory and all data included files and subdirectories (use with extreme caution)
  • cp file1 file2  -  Copy file1 to file2
  • cp -r dir1 dir2  -  Copy dir1 to dir2; create dir2 if it doesn’t exist
  • cp file /home/directory_name  -  Copy the filename called file to the /home/dirname directory
  • mv file /home/directory_name  -  Move the file called filename to the /home/dirname directory 
  • mv file1 file2  -  Rename or move file1 to file2; if file2 is an existing directory, moves file1 into directory file2
  • cat file  -  Display the file called file
  • uptime  -  Shows how long your system has been running and the number of users currently logged in; It also displays load average for the past 1,5 and 15 minutes
  • w  -  Shows who is logged on and what they are doing
  • free  -  Displays amount of free and used memory in the system
  • top  -  Displays processor activity of your system. It will show processor and memory usage as well.
  • kill  -  Used to terminate processes (which are hung for some reason for example) First find relevant process id with the ps command and then use kill to kill it.                                                                                                                    Ex. kill -9 7506 (Note: 7506 is the process id of the process to be killed)
  • df  -  Reports file system and disk space usage
  • du  -  Summarizes disk usage for each different files
  • man  -  Used to see the show the manual of the inputted command
As an example I gave the command mv to see the manual. The output is shown in below screenshot.


Basic Linux Commands Basic Linux Commands Reviewed by DAL on June 26, 2017 Rating: 5

No comments:

Powered by Blogger.