Linux is a powerful operating system that comes in different variants. You’ve just seen the introduction and basic terminologies of Linux through our previous articles, but You might not be familiar with the Linux operating system functions and different Linux commands. So, In this article, we will go over some of the most basic Linux terminal commands and how they function in Linux operating systems. These basic commands will help make Linux a little more user-friendly and help you get some serious work done.
Table of Contents
Before listing the basic Linux commands, Let’s talk about the purpose of using commands and their syntax.
The commands allow users to control and manipulate their computer systems. They can be used to perform a variety of tasks, such as accessing files and directories, running programs, and altering system settings. This article provides an overview of the most common Linux commands, with examples of how they can be used.
The usual syntax of shell commands seems like this:
- command parameter
Or we can say like this “command – option argument”.
Parameters are options that are written after the commands and separated by a space. These parameters can be short or long.
- Short parameters are nothing but, parameters constituted by a single letter preceded by a dash. Example syntax: Command -a single letter
- Long parameters are nothing but, parameters consisting of several letters preceded by two dashes. Example syntax: Command –long parameter.
Check out the list of commands below for a clear understanding of parameters with examples, especially the “ls” Command.
List of Basic Linux commands:
Firstly, Let’s become super users. I mean the Root user.
open up your terminal and type the command “sudo su”. It will ask us to enter our password to become a root user. Enter your profile password and that’s it. You are a root user now!
- sudo – super user do
Don’t confuse this with the root directory. I hope you remember the difference between the root user and the root directory. If not, then click here to see.
To know about our system information, we can use the command “uname [options]”. For example, uname -a prints all the system information such as kernel name, kernel version, etc.
If no options are given, then by default it will print only the kernel name.
- Here, uname is the command and -a is the parameter(Short parameter).
If we want to know about other commands this “Man” will help.
For example: suppose I want to know more about the “sudo” command, then I will type “man sudo”. This will open the user manual for the sudo command.
- Man – manual.
Now, Let’s know where we are now. I mean in which directory we are working currently? For this, just type “Pwd”.
- Pwd – print working directory.
Okay, now we know our working directory but what are the other directories and files which are present inside our working directory? To find this, Type the command “ls”. This will list the things present inside our working directory.
- ls – list directory contents.
Here are some parameters of ls commands which will help us to know more about the listed items.
- ls -l: Long list format.
- ls -a or ls –all: List all hidden contents that start with Dot(.)
-a is the short parameter and –all are the long parameter used with the command “ls”.
we saw there are a few sub-directories inside our working directory but how can we get inside those sub-directories?
For this, type “cd <directory name>”. For example, cd Desktop.
- Cd- change directory
Note: Linux is case-sensitive. It will work only if we type “Desktop” and not “desktop”.
cd .. :
Yes, we got inside another directory but how can we go back to the previous directory? To get back, type this command “..” or “cd ..”
Use this “clear” command to clear everything from the terminal screen.
This exit command is used to exit from any tools, modes, terminal, etc. For example, We were logged in as root users using the “sudo” command. To exit from root user mode just type the “exit” command.
Through this article, we have shown you some of the most commonly used Linux commands and provided an overview of what they do. I hope now you have a good understanding of how to use these commands and be able to navigate your system more easily. Linux knowledge is one of the essential things for a cybersecurity analyst so get used to Linux and its commands.
This is just part one of the basic Linux commands and there are many more parts with a set of commands yet to come. Subscribe to our newsletter to get notified and stay in the loop. Thanks for reading! Share your thoughts in the comment section.