Linux is no doubt one of the best operating systems that currently exist and serves as a backbone for most of the web servers these days. But operating this OS can get a bit confusing for the new users coming straight out from the Windows platform. Many Linux flavors such as Ubuntu provide you with a great GUI to get things done, but that is not the case for all of them.
So here we are, to help you learn the basic and most useful Linux commands you should know about.
Note: Every command needs to be typed in the terminal window. You can search for ‘terminal’ or press Ctrl+Atl+T to bring the terminal up.
1. cd – Change Directory
The cd command should be used followed by the name of a directory including the full path to that directory.
root@techpiration:~# cd /home/user/Desktop
To move one directory up, you can use the shortcut command:
root@techpiration:~# cd ..
2. ls – List Directory
The ls command list the contents of the folder, be it file or folder, from which it runs.
root@techpiration:~# ls Android-Games Music Pictures Public Desktop Techpiration Documents Videos Downloads Templates
3. mkdir – Make Directory
The mkdir command creates a new directory with name path. However if the directory already exists, it will return an error message “cannot create folder, folder already exists”.
root@techpiration:~# mkdir Assignments
4. cp – Copy
The cp command is used to “Copy” things from one place to another.
root@techpiration:~# cp /home/user/Downloads moon.png /home/user/Desktop
5. mv – Move
The mv command moves a file from one location to another location.
root@techpiration:~# mv /home/user/Downloads moon.png /home/user/Desktop
6. pwd – Print Working Directory
The “pwd” command prints the current working directory with the full path name.
root@techpiration:~# pwd /home/user/Desktop
7. rm – Remove
The rm command is used to delete a file from the system.
root@techpiration:~# rm /home/user/Desktop/todoList.txt
8. rmdir – Remove Directory
The rmdir command lets you delete the directories you made using mkdir. Make sure that the directory you are about to delete is empty or an error will be presented.
root@techpiration:~# rmdir Assignments
9. ifconfig
The ifconfig command lets you view information about the network adapters on your system. It contains useful info like MAC address, gateway etc.
root@techpiration:~# ifconfig eth0 Link encap:Ethernet HWaddr 00:00:11:22:33:99 inet addr:10.0.2.3 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: ff30::a00:43bb:edcd:aa99/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:18906 errors:0 dropped:0 overruns:0 frame:0 TX packets:17565 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:8109372 (7.7 MiB) TX bytes:8447465 (8.0 MiB)
10. history
The history command stands for History (Event) Record, it prints the history of long list of executed commands in terminal.
root@techpiration:~# history 1 cd /home/user/Desktop 2 cd .. 3 ls 4 mkdir Assignments 5 cp /home/user/Downloads moon.png /home/user/Desktop 6 mv /home/user/Downloads moon.png /home/user/Desktop 7 pwd 8 rm /home/user/Desktop/todoList.txt 9 rmdir Assignments
We hope these commands will help you explore the Linux environment and perform basic tasks easily.
Also, If you want to try various flavors of Linux you can check out Top 10 Linux Distros.