Kali Linux System Management

Cyb3rShot

Cyb3rShot

Moderator
Joined
Jan 12, 2023
Messages
51
Reaction score
10
Points
0
Here we will learn about starting/stopping system service, installing stuffs on Linux and much more. We are covering things as a penetration testers perspective on our Kali Linux system. But this same things can be done on any Debian based Linux distribution, like Ubuntu, Linux Mint, Elementary OS etc.

To open this link, you need to Register on the forum or have 50+ comments or topics. If you do not wish to wait, you can Upgrade your profile.

These things we are going to learn will lead our whole Linux (specially Debian-based) journey not only Kali Linux.


Linux Host Information


To know our hostname on Linux, we just need to execute the hostname command on our terminal window. As we can see in the following screenshot:​

To open this link, you need to Register on the forum or have 50+ comments or topics. If you do not wish to wait, you can Upgrade your profile.

Hostname is the name of our computer. If we want to change it we can edit it's configuration file by sudo nano etc/hostname command. Then we put their our required name for the computer. Then we need to save it then reboot too see the effects.​


Linux OS Information


Knowing the information of an Operating System or OS is very essential for privilege escalation. So that the penetration tester can gain information if the version used is vulnerable. To know the information of the OS we need to run uname -a command.​

To open this link, you need to Register on the forum or have 50+ comments or topics. If you do not wish to wait, you can Upgrade your profile.

In the above screenshot we had used -a flag to know all the information. If we need any specific information about then we can use different flags like kernel name (-s), network node hostname (-n), kernel release (-r), kernel version (-v), machine hardware name (-m), processor type (-p), hardware platform (-i), name of operating system (-o).


Linux Hardware Information


On Linux system, if we want to know about our system's hardware information then we need to know these commands.​

To check our CPU information we need to check our /proc/cpuinfo by using following command:​

cat /proc/cpuinfo

To open this link, you need to Register on the forum or have 50+ comments or topics. If you do not wish to wait, you can Upgrade your profile.

Almost same way if we wanna check our RAM information then we need to run cat /proc/meminfo command. We can see the output on the following screenshot.​

To open this link, you need to Register on the forum or have 50+ comments or topics. If you do not wish to wait, you can Upgrade your profile.

To see attached devices with our system (like hard disk, disk partitions etc), then we need to use sudo fdisk -l (here -l flag displays partitions) command. This also show us external drives connected with our system.​

To open this link, you need to Register on the forum or have 50+ comments or topics. If you do not wish to wait, you can Upgrade your profile.

To display the list of USB devices like mouse, keyboard, thumb drive,
To open this link, you need to Register on the forum or have 50+ comments or topics. If you do not wish to wait, you can Upgrade your profile.
, rtl-sdr etc we need to use lsusb command. As we can see in the following screenshot.​

To open this link, you need to Register on the forum or have 50+ comments or topics. If you do not wish to wait, you can Upgrade your profile.

To see all the mounted directories into the file system, then we need to execute mount command.​

To open this link, you need to Register on the forum or have 50+ comments or topics. If you do not wish to wait, you can Upgrade your profile.


Managing Services on Linux


Services are servers that can run on our Linux or Kali Linux system, such as SSH Apache, FTP etc.​

To manage  services on Linux we need to use commands like following​

  • sudo service servicename status to check the status of the service.
  • sudo service servicename start to start a service.
  • sudo service servicename stop to stop a service.
  • sudo service servicename restart to restart a service.

We also can use sudo systemctl servicename status/start/stop/restart to do the same thing.​


Package Management


For doing package management first we need to update our Kali Linux system's repository. We have an entire article on
To open this link, you need to Register on the forum or have 50+ comments or topics. If you do not wish to wait, you can Upgrade your profile.
. In short Kali Linux repository is located on /etc/apt/sources.list, we can open it by using following command:​

Code:
sudo nano /etc/apt/sources.list
After putting sudo password we can see the default repository in the following screenshot:​

To open this link, you need to Register on the forum or have 50+ comments or topics. If you do not wish to wait, you can Upgrade your profile.


We can update our system or download new tools directly from repository. to update our system (like Windows update), we need to run following command:

sudo apt update -y

To upgrade the system we need to run following command:​

Code:
sudo apt upgrade -y
We have an previous article on
To open this link, you need to Register on the forum or have 50+ comments or topics. If you do not wish to wait, you can Upgrade your profile.
system.​


Installing Packages on Linux


There are various ways to installing packages or software on Linux system. Commonly there are two ways:​

  • Installing from software packages.
  • Installing from repository.

When we are installing a software package, we need to download the package with .deb extension from the internet then we need to run sudo dpkg -i filename.deb command to install the package.​

To download packages from repository we need to run command like sudo apt install packagename command.​

To remove software package from our system we need to run sudo apt remove packagename command.​

To find a package name on repository we need to run command apt-cache search packagename.​

Finally, if we need to install a package and we're not sure if the package is exists on the repository or not we need to run command apt-cache show packagename.​


Process Management on Linux



One of our most favorite process management tool on Kali Linux is htop. But it is not come pre-installed on Kali Linux. We need to install it from repository by using following command:

sudo apt install htop

To open this link, you need to Register on the forum or have 50+ comments or topics. If you do not wish to wait, you can Upgrade your profile.


After installing it we need to run htop command and we can see all the  running process on our terminal window, as we can see in the following screenshot:





To open this link, you need to Register on the forum or have 50+ comments or topics. If you do not wish to wait, you can Upgrade your profile.





[SIZE=x-small]While taking screenshot, we got the highlighted process[/SIZE]





Another way to get the list of currently running process is by using the ps -A u command, as we can see in the following screenshot.

To open this link, you need to Register on the forum or have 50+ comments or topics. If you do not wish to wait, you can Upgrade your profile.

We can see the PID (Process Identification Number) on both screenshot we can this are the numbers of the processing. We can stop any processing services by running kill PID_NUMBER command. If the system refuse to kill it we can do it forcefully by applying kill -9 PID_NUMBER command.