Linux Essential Commands

Today I will tackle essential Linux commands that will allow you to navigate through the terminal with ease.

These commands are commonly used by developers, system administrators, and other technical professionals who work with Linux and other Unix-based systems, however, you will often find yourself in the need to use them.

Note: If you type “man <command>” on the terminal, it will display all the alternatives of the especified command with their respectives explanations.

cd  | Change directory command allows the user to navigate through the file explorer.

cd .. | This command takes you one directory back from the current directory you are in.
 
Example : root@user $ cd /home/desktop/downloads
                 root@user downloads $ cd ..
                  root@user desktop $
 
pwdPrint Working Directory command allows users to see the path of the current working directory.
 
Example: root@user $ pwd
                /home/desktop
 
ls | Lists you the general information in a directory
 
ls -l | List long lists the user more detailed information, you could add the [-a] flag to this command in to see all the hidden files inside the specified directory.
 
touch | Creates files.
 
mkdir | Makes new Directories.
 
sudo | Super user do, allows to openly make any changes or perform any tasks, however, it may ask the user root password for security reasons.
 
rm | Remove files
 
rm -f | Remove force command deletes files whether they are protected or not.
 
rmdir – Remove empty directories only.
 
rm -r | In order to remove a directory and its content we have to use the (-r) flag command which stands for recursive.
 
vim | File editor tool.
 
cat | Concatenation command shows the content within a file, however, it is not recommendable to use when revising large files.
 
less | Less is more secure when revising large files, it allows the user to easily navigate through all the data inside the file by pressing the up and down keys.
 
echo text > filename.txt | This command will create a file and also the [text] part will be inside the specified file, this happens because the echo command takes input and returns output.
Moreover, the [>] is a redirection operator that allows us to assign where the output goes.
 
grep | It’s a tool for searching text.
 
chmod | Change mode allows to modify and change permissions.
                
 Example: root@user $ chmod u+wrx <filename>
                
U = User                W = Write
G = Group              R = Read
O = Other               X = Execute
 
chown | Change ownership.
 
alias <aliasname> = ‘command ‘ | This command allows the user to pick an alias name to run a certain command, for instance, if the command is [ls] and you name it [show], then your alias “show” will execute, to remove the alias you can either reboot your operating system or do a [unalias aliasname].