This list of Linux terminal commands contains all the common commands. Think of it as a Linux command cheat sheet as it contains almost all the basic ones to get you started.
mkdir[edit | edit source]
The name says it all. The mkdir command in Linux is used to create a new directory or, if you’re coming from Windows, a Folder.
mkdir folder name
Where “folder name” is the name of the folder you want to create.
echo[edit | edit source]
Echo is the simplest command in Linux. It is used to display text that is passed after the space in the command.
$ echo "Hello!" "Hello"
The echo command might seem useless, but it is used in debugging pre and determining the program’s state. If you know a little bit of programming, think of it as a print statement that only outputs a string.
Python3 print("onix") >> onix
pwd[edit | edit source]
PWD stands for Print Working Directory. This gives us a quick way of finding out the working directory path.
olmaster@onix:~$ pwd /home/olmaster
cd[edit | edit source]
Cd is an acronym for the change directory. As the name suggests, it is used to temporarily change the directory you’re working in.
olmaster@onix:~$ cd /Desktop olmaster@onix Desktop:~/Desktop$
cp[edit | edit source]
The command cp is used to copy and paste a file to a directory specified as the second argument.
olmaster@onix:~/Desktop$ cp hello.ola /home/olmaster/Downloads
In the above command, “new.txt” is the file that we copy to the directory “/home/focusblast/Downloads.”
mv[edit | edit source]
The mv command in Linux stands for “Move.” It is used to move files or directories from one place to another. Consider a file “move.” To move it to the Downloads folder, all we need to do is:
olmaster@onix:~/Desktop$ mv hello.ola /home/olmaster/Downloads
man[edit | edit source]
The manual page (man) command is like software documentation using which you can know what a particular command does and how it works:
olmaster@onix:~$ man cp CP(1) User Commands CP(1) NAME cp - copy files and directories SYNOPSIS cp [OPTION]... [-T] SOURCE DEST cp [OPTION]... SOURCE... DIRECTORY cp [OPTION]... -t DIRECTORY SOURCE... DESCRIPTION Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY. Mandatory arguments to long options are mandatory for short options too. -a, --archive same as -dR --preserve=all --attributes-only don't copy the file data, just the attributes --backup[=CONTROL] Manual page cp(1) line 1 (press h for help or q to quit)
ls[edit | edit source]
The ls command is used for listing the contents of a directory.
olmaster@onix:~$ ls Downloads Public Documents Templates Videos Music Pictures VMs
9. cat[edit | edit source]
The cat command is used to print or merge the content from the line where the first file ends.
olmaster@onix:~$ cat hello.ola println("hello!")
The command to merge two files and create a new file or merge them in any two files would be.
cat file1 file2 > file3 #This will merge files in file 1 and file 2 in a new file
Now, the cat command has a lot of commands that we couldn’t fit in this article. You can use the command “man cat” to learn more about it.
rm[edit | edit source]
The rm command is used to remove files and directories. You’ll need both rm and -r (recursive) to remove a directory.
rm new2.txt #removes the file sudo rm -rf directory #removes the directory
The f in “-rf” is used to tell rm to ignore files and arguments that don’t exist.
zip/unzip[edit | edit source]
Zip is used to create a new zip file, whereas Unzip is used to unzip zipped files. Here’s how you you Zip and Unzip commands.
olmaster@onix:~$ zip olangfiles.zip file1.ola file2.ola
In the above command, olangfiles.zip is the name of the zipped file in which we’re going to put the two text files file1.ola and file2.ola.
To extract all the files from a zipped file using the command.
olmaster@onix:~$ unzip olangfiles.zip
Replace “newzipfile” with the name of the zipped file you want to extract.
wget[edit | edit source]
wget is a handy command that can help you download files from the internet. Here’s how to use it:
wget "download link"
top[edit | edit source]
Similar to Windows Task Manager, top command shows you the list of running processes and how much CPU is being used.
history[edit | edit source]
The history command is used to display the commands that you’ve typed before.
wc[edit | edit source]
The wc command is used to count the number of lines (-l), words (-w), bytes (-c), and characters (m).
olmaster@onix:~$ wc -l filename.ola 666 filename.ola
clear[edit | edit source]
As the name suggests, clear is used to clear the terminal screen.
passwd[edit | edit source]
You guessed it right! The passwd command is used to change the password of the user account. To use it, type passwd followed by the username.
olmaster@onix:~$ passwd olmaster
chown[edit | edit source]
The chown command is used to transfer the ownership of files. Let’s assume there’s a file named file1 and you’re olmaster. You want to transfer the ownership to user1.
olmaster@onix:~$ chown olmaster file1.ola
You can also transfer the ownership to root using the command.
sudo chown root file1.ola
yay / pacman[edit | edit source]
Yay/ Pacman stands for Advanced Packaging Tool. It is one of the most popular and powerful package managers for Onix OS / Arch Linux. For starters, a package manager essentially automates the process of installing and removing applications.
The following command installs the flameshot application, which is one of the most popular screenshot tools on Linux.
olmaster@onix ~$ sudo pacman -S flameshot olmaster@onix ~$ yay -S flameshot
reboot[edit | edit source]
The name says it all. Reboot command is used to reboot, shut down, or halt the system.
chmod[edit | edit source]
The chmod command is used to change the read (-r), write (-w), and execute (-x) instructions of a file. An example of chmod command would be:
chmod 742 program.ola
Here’s what the numbers mean.
The first number (7) in the above command represents the permissions that you’re giving to the user i.e. Read, Write, and Execute.
The second digit (4) is the permissions given to the file itself, which, in this case, is “Read Permissions only.”
The third and final digit (2) represents the permissions given to everyone who’s not a part of the group.
grep[edit | edit source]
The grep command is used to search and find text in a file.
grep "hello" text.ola
locate[edit | edit source]
Similar to the search command in Windows, the locate command is used to locate files in Linux.
$ locate text.ola /home/olmaster/Desktop/text.ola
sudo[edit | edit source]
The only command of all that you’ll end up using the most. The acronym for Sudo is SuperUser Do, using which you can fiddle with the files that require root permissions.
Mind you, if a file needs root privileges, it’s probably important to the OS. Hence, we suggest not to play around if you don’t know what you’re doing.
hostname[edit | edit source]
The hostname command is used to know your device name. Additionally, using the -I argument will help you know your IP address.
$ hostname olmaster $ hostname -I 127.0.0.1
exit[edit | edit source]
The exit command can be used to close the terminal quickly.
df[edit | edit source]
Suppose you want to know the space in every disk partition, type df. The default space metric is Kilobytes but, you can use the argument “-m” to change it to Megabytes.
$ df -m
netstat[edit | edit source]
The netstat command can be used to check the network statistics, interface statistics, routing table information, and much more.
fdisk[edit | edit source]
The fdisk command will list all the partitions and the information like the partition name, sectors, size, and partition types. fdisk needs superuser permissions to run.
$ sudo fdisk -l
vim[edit | edit source]
vim is my favorite text editor in Linux. If you want to open up a text file, you can type “vim” followed by the “filename” if you’re in the directory where the file is present to open it up.
When you’re done editing the text file, press the key combination “Ctrl+O” to write the changes and “Ctrl+X” to exit. To learn more about Nano, you can also go to the help section by pressing “Ctrl+G.”