Hello Security Enthusiasts!!!

Apologies for not writing further since long! But now I am here and let's try to be consistent and keep learning Ethical Hacking. I believe you guys are up and running Kali Linux as mentioned in my previous blog. If not, please revisit the previous blog and set up your Kali Linux.

So, today we will try to understand a couple of questions on Linux and why it is so famous amongst Hackers.

What is Linux?

Linux is a kernel which connect OS and Hardware. Linux was firstly developed by Linus Torvalds in 1991, who was a computer science student at University of Helsinki, Finland. He wants to create something which is open-source and free of cost. As a result of the same, we have different varieties of Linux based operating systems such as Ubuntu, Kali Linux, Fedora, CentOS, Linux Mint, etc.

Why Linux is favorite amongst the hacking community?

Since we all know that Linux is open source and due to its portability, availability and customizability make it easier to use. Linux OS are lightweight as compared to Windows OS and hence it runs with minimum hardware requirements which makes it favorite for hackers.

Now let us have a look few of the important Linux commands which will be very helpful when you get started with Ethical Hacking. Hit Ctrl+Alt+T to open the terminal or, simply search terminal in application and open. One most important thing to keep in mind while using Linux terminal is all the commands are case-sensitive and will only work if it is written rightly.

1. top Command

top command is the command-line default utility which comes pre-installed on Linux distros. It will help user know all the running processes and their details such as CPU consumption, user, PID (Process ID), Memory, Command, etc.

Once the top command is executed, you will be able to get see the constant output on terminal screen. As mentioned earlier, we can see the continuous output, and it will not stop until we press Ctrl+C.


2. uname Command

→  uname command will print the system information including kernel name and version. It also prints details information when used with '-a'.

3. sudo Command

The sudo command stands for "superuser do" allows a user with root permissions to execute commands as another user, such as the superuser. sudo command is equal to 'run as administrator' in windows.

 

Using sudo commands, one can enter into root privileged/root user for limited time duration. Once the time expires, the user is expected to enter the password again to regain sudo rights.

Be careful while using commands under sudo user cause every action taken is irreversible as a root.

4. chmod Command

→ On Linux, file access is being manged based on the permission and ownership given to it. In Linux, file is associated with three different permissions i.e. read, write & execute. And in addition to that, there are 3 different user classes which are taken into the consideration when applying above-mentioned 3 permissions. The classes are as follows:

- File Owner (First user)

- Group Members (users in the group of assigned people.)

- Other (all the users on the system/everybody)

First, let us try and understand what are the permissions by default given to the test file. Later, we will see how we can extend or reduce file permissions using chmod command.

Type in "ls -l <filename>" and you will see some random strings in the beginning of file -rw-rw-r-- 1. First letter could any three of -, d, l.

- means it is a normal file

d means it is a directory

l means it is a link

Post that, you can see r, w, x letters which represents read, write and execute operations with respect to available permission.


Now we will use chmod command to extend the permission and see the usage of the same. Type in "sudo chmod 777 <filename>" and observe the output.

 

In the above snap, we can see that the file permissions are changed and now anyone can access the file for read, write and execute operations. Same way, if we want to reduce the file permission, we can do that using chmod itself and adding permission parameters. "sudo chmod 744 <filename>"


5. passwd Command

passwd is a Linux command which allows user to change the password and setup new password. It will ask for the old password before setting up the new one.


Also, when the user is in root mode, he/she can change any other users' password by setting username and password. This will not ask for the old password of the user whose account is being altered. "passwd <username> <new password>"

 

6. whoami Command

whoami command is a pre-installed Linux command utility which prints the current logged-in user in terminal session. 


Similarly, one can use "who" command to view a logged-in user along with date and time of login.


7. shutdown Command

shutdown command lets the user turn off the system in safer mode. Upon execution of shutdown command, the system notifies all the users to save their work before it gets turned off and also will not allow any new user to login. One can schedule the shutdown by using date and time format.



As we can see in the above snap, the user has executed the shutdown command with given time of 2 mins to turn off the system. Similarly, poweroff and reboot command works with Linux terminal to turn off and restart the system.

 

8. alias Command

alias helps user to change the pre-defined command string to another string. It is majorly being used to avoid tracking and getting identified during the hacking process. Hackers can replace certain risky events into some common where execution of the same ends up doing unwanted action.

Let us take an example in which CD string can be replaced with "cd /home/Documents". Below-mentioned snap will give better idea.


9. cd Command

→ Basically cd means Change Directory "cd" which navigates a user to the desired destination folder. When the user wants to move from one directory to another, cd command can be used. "cd <destination directory>"


10. mkdir command

mkdir command allows a Linux user to create a directory/folder using terminal. It can be used to create subdirectories too. In a scenario where the parent directory does not exist, mkdir creates one, and then it will create a subdirectory inside it.

 

rmdir is the command which can be used for deleting directory on Linux.


11.  cat Command

→ The cat command allows user to create and view file content. It can be used to concatenate files and redirect the output to terminal. The cat command stands for "concatenate" and it is majorly being used to view file contents in terminal.


12. mv command

→ The name itself suggests that mv command can be used to move files or directories from one place to another.

That's all for today's tutorial, and we will be continuing more important Linux commands in the next blog.

Till the time, be safe and careful. Keep following us for more and more security updates and learning. Inferno Infosec wishes you a very Merry Christmas.

Kindly contact us at infernoinfosec@gmail.com for more details regarding different security courses and services.

0 Comments