In this article we are going to explore Top 20 Linux commands for Hackers 2023.
1: The OS type
uname -o
The first command, uname -o
, displays the type of operating system installed on your machine.
2: CPU architecture
uname -m
The second command, uname -m
, provides information about the CPU architecture on your system.
3: The kernel version
uname -r
The third command, uname -r
, tells us the kernel version running on our system.
4: The OS name, release, version
cat /etc/os-release
The fourth command is cat /etc/os-release
. This command provides us with the name, release, and version of the operating system.
5: The system hardware
lshw
The fifth command is lshw
. This command gives us complete information about the system hardware.
6: The CPU details
lscpu
The sixth command is lscpu
. This command provides detailed information about the CPU.
7: Check system memory
free -h or free -m
The seventh command is free -h
or free -m
. This command allows us to check the system memory.
8: Check the virtual memory stats
vmstat -S m
The eighth command is vmstat -S m
. This command helps us check the statistics of virtual memory.
9: display information about currently running processes
ps all
The ninth command is ps all
. This command provides information about all currently running processes on the system.
10: search packages for installation
apt search
For Example: apt search python-boto
For example: apt search python-boto
The tenth command demonstrates apt search
. This command allows us to search for packages available for installation.
11: To installed package
sudo apt-get install
Example: sudo apt-get install mariadb-client
The eleventh command is about installing packages in Linux. With the apt-get install <package name>
command, you can install packages. Sometimes, sudo apt-get install
command is used to install packages requiring administrative privileges.
12: Find current Directory
pwd
The twelfth command helps us find the current directory. By running the pwd
command, we can determine which directory we are currently in.
13: Uninstall package
sudo apt-get remove
Example: sudo apt-get remove sqlmap
The thirteenth command is sudo apt-get remove
. With this command, you can uninstall or delete any package from your Linux operating system.
14: List the mounted disk drives
df -kh
The fourteenth command is used to list the mounted disk drives in Linux. By running df -kh
, you can easily check the mounted disk drives on your system.
15: To mount the volume
First, you need to create a directory. After creating the directory, you can mount it using the following commands:
mkdir -p
sudo mount
By executing these commands, you can mount a directory that you have created.
16: List biggest files from directory (biggest 5)
sudo du -a /etc/ | sort -n -r | head -n 5
The sixteenth command helps you find the largest files in a specific directory. In this example, sudo du -a /etc/ | sort -n -r | head -n 5
retrieves the largest 5 files from the /etc/
folder.
17: Find the file
find /home/ -name "*.txt"
The seventeenth command allows you to find files. For example, if you want to find all files with the .txt
extension in a specific directory, you can use the find /home/ -name "*.txt"
command.
18: Search the text string in a directory and print filename containing that string
grep -ril "hello" /home/masaud
In the eighteenth command, we use the grep
command. With grep
, you can search for a specific string value or pattern in files. The command grep -ril "hello" /home/masaud
searches for the string “hello” in the /home/masaud
directory and prints the filenames containing that string.
19: File the text string from a given directory
grep -rIn (search text)
The nineteenth command, grep -rIn novaexperience.net
, allows you to search for a specific text string in files within a given directory. In this example, it fetches data containing the text “novaexperience.net” from files in the desktop directory.
20: Linux commands to display a colorful and dynamic system information dashboard
watch -n 1 "echo -e '\033[0;36mSystem Information:\033[0m'; lscpu | awk '/Model name/ {print \"\033[0;33mCPU:\033[0m\", \$3, \$4, \$5, \$6}'; free -h | awk '/Mem:/ {print \"\033[0;33mMemory Usage:\033[0m\", \$3, \"/\", \$2}'; df -h / | awk '/\// {print \"\033[0;33mDisk Usage:\033[0m\", \$3, \"/\", \$2}'; echo -e \"\033[0;33mUptime:\033[0m\" $(uptime -p)"
we have also created a beautiful web security roadmap for learners. click here and explore further.
Follow Me on Linkedin