March 25, 2022
In our this article we are going to learn how we can handle our Linux box. This is the basics for system admins and penetration testers. 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.
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.
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:
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 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 display the list of USB devices like mouse, keyboard, thumb drive,
To see all the mounted directories into the file system, then we need to execute mount command.
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