Kali Linux Cheat Sheet
Kali Linux Cheat Sheet · from Anas-Magane/Pentesting (COMMANDS LINUX).
About#
This file is a simple, clear cheat sheet for Kali Linux. It explains:
- Installation options
- Common problems and quick fixes
- Important commands (navigation, files, editing, viewing)
- Process and system commands
- Network commands
- Permissions and
chmod - Sudo vs no-sudo examples
- Common Kali tools and what their GUI icons do
1. Installation (Simple)#
Two ways to install Kali:
- Real install (main system):
- Install directly on your computer.
- Fast and full performance.
- Risk: can erase data if you are not careful.
- Virtual machine (recommended for beginners):
- Use VMware Workstation, VirtualBox, or other VM software.
- Safer and easier to test.
- Slightly slower than real install.
VM Network modes (simple):
- NAT: VM uses host's IP for internet. Good for simple internet access.
- Bridged: VM gets its own IP from the local network. Good when you want VM to be a separate machine on the LAN. (Recommended when you want each device to have its own IP.)
- Host-Only: VM can talk only with the host machine. Good for isolated testing.
Keyboard layout (AZERTY → QWERTY example):
bash
sudo dpkg-reconfigure keyboard-configuration2. Basic Navigation and File Commands#
bash
cd <dir> # change directory
pwd # print working directory (show current path)
ls # list files
ls -la # list all files with details (hidden files too)
mkdir <dir> # make a new directory
touch file.txt # create an empty file or update timestamp
rm file.txt # remove (delete) a file
rm -r folder/ # remove folder and everything inside (be careful)
mv src dest # move or rename file/folder
cp src dest # copy file or folder (use -r for directories)3. File Editing (Top editors)#
Simple editors:
- nano · easy terminal editor
- gedit · GUI editor (GNOME)
- mousepad · lightweight GUI editor
- vim / vi · powerful terminal editor
- emacs · powerful & programmable editor
- code · Visual Studio Code (GUI)
- subl · Sublime Text (GUI)
- kate · KDE GUI editor
- atom · Atom editor (GUI)
- leafpad · small GUI editor
Open and edit a file:
bash
nano file.txt
vim file.txt
gedit file.txt &4. Viewing / Displaying Files (Top commands)#
bash
cat file.txt # display whole file
less file.txt # view file page by page (scroll up/down)
more file.txt # view file page by page (basic)
head -n 10 file.txt # show first 10 lines
tail -n 20 file.txt # show last 20 lines
tail -f file.log # follow file as new lines are added
nl file.txt # show file with line numbers
awk '{print $1}' file # print first column of each line (text processing)
awk '{print}' file
sed -n '1,10p' file # print lines 1 to 10 (stream editor)
cut -d',' -f1 file.csv # cut column 1 using comma as delimiter
sort file.txt # sort lines
uniq file.txt # remove duplicated adjacent lines5. Searching and Grep (options)#
bash
grep "text" file.txt
grep -i "text" file.txt
grep -r "text" .
grep -v "text" file.txt
grep -n "text" file.txt
grep -o "pattern" file.txt
grep -E "a|b" file.txt
command | grep "text"6. Output control and pipelines#
bash
head -n 5 file.txt
tail -n 10 file.txt
command1 | command2
ps aux | grep firefox
ls -la | head -n 207. Process and Services#
bash
ps
ps aux
ps -ef
top
htop
kill PID
kill -9 PID
pkill processname
systemctl status name
sudo systemctl start name
sudo systemctl stop name8. System Information#
bash
whoami
id
uname -a
hostname
date
uptime
free -h
df -h
du -sh folder/9. Sudo vs No Sudo (examples)#
Without sudo:
bash
ls /home
cat /etc/passwdWith sudo:
bash
sudo apt update
sudo apt install package
sudo useradd -m newuser
sudo passwd username
sudo reboot10. User and Password Management#
bash
passwd
sudo passwd user
sudo useradd -m user
sudo usermod -aG group user
sudo userdel -r user11. Network Commands#
bash
ping google.com
ip addr
ifconfig
ip link
ip route
netstat -tuln
ss -tuln
nmcli device status
iwconfig
iwlist scan
arp -a
ssh user@host
scp file user@host:/path
wget URL
curl URL12. File Permissions and ls -la explained#
Example:
text
-rwxr-xr-- 1 alice staff 2048 Jan 01 10:00 file.txtBreakdown:
- First char:
-= file,d= directory,l= link - Owner rwx = 7, Group r-x = 5, Others r-- = 4 → 754
13. chmod examples#
bash
chmod 755 file.txt
chmod 644 file.txt
chmod 700 file.txt
chmod +x script.sh
chmod u+x script.sh
chmod g-w file.txt14. Links (hard links vs symbolic links)#
bash
ln file linkname # Hard link
ln -s /path/to/file link # Symbolic link15. Useful small commands#
bash
echo "hello world"
clear
history
man command
whatis command
which command
time command16. Common grep + awk + sed examples#
bash
grep -n "error" logfile.log
ps aux | grep -i ssh
awk '{print $1, $3}' file.txt
sed -n '2,4p' file.txt
sed -i 's/old/new/g' file.txt17. Top system commands#
bash
whoami
uname -a
sudo apt update
sudo apt upgrade
reboot
shutdown now
last -a
dmesg
journalctl -xe18. Common Kali tools and GUI icons (simple)#
- nmap · Network scanner
- netdiscover · Find local devices
- dnsenum/dnsrecon · DNS info
- OpenVAS/Greenbone · Vulnerability scanner
- nikto · Web server scanner
- Metasploit (msfconsole) · Exploitation framework
- aircrack-ng / wifite · Wireless testing
- john / hydra · Password attacks
- Burp Suite / dirb / gobuster · Web testing
- Wireshark / tcpdump · Packet analysis
- Autopsy / sleuthkit · Forensics
- KeepNote / CherryTree / Zenmap · Reporting & GUI scans