Kali Linux Basics: Cheat Sheet for Beginners
- Cracking & Hacking
-
cc cleaner, clear logs, clear tracks after hacking, cracking & Hacking, kali linux, kali linux cheat sheet, log cleaner, penetration testing, remove logs, shred clearing tracks, timestomp
- November 13, 2024
🧭 Navigation & Directory Management
Command |
Description |
Example |
pwd |
Print current directory |
pwd |
ls |
List directory contents |
ls |
ls -l |
List contents with details |
ls -l |
ls -a |
Include hidden files in listing |
ls -a |
cd [directory] |
Change directory |
cd Documents |
cd .. |
Move up one directory |
cd .. |
cd ~ |
Go to the home directory |
cd ~ |
mkdir [folder_name] |
Create a new directory |
mkdir new_folder |
rm [file] |
Delete a file |
rm file.txt |
rm -r [directory] |
Remove a directory and contents |
rm -r old_folder |
cp [source] [dest] |
Copy files or directories |
cp file1.txt file2.txt |
mv [source] [dest] |
Move or rename files or directories |
mv file.txt newname.txt |
Command |
Description |
Example |
cat [file] |
Display file contents |
cat notes.txt |
less [file] |
View contents with scroll option |
less notes.txt |
head -n [num] [file] |
Show the first n lines of a file |
head -n 5 notes.txt |
tail -n [num] [file] |
Show the last n lines of a file |
tail -n 5 notes.txt |
nano [file] |
Open file in nano editor |
nano notes.txt |
vim [file] |
Open file in vim editor |
vim notes.txt |
🔍 Search for Files and Text
Command |
Description |
Example |
find [path] -name [filename] |
Find files by name in a path |
find / -name file.txt |
locate [filename] |
Quickly locate files (uses index) |
locate file.txt |
grep '[text]' [file] |
Search text within a file |
grep 'error' log.txt |
grep -r '[text]' [dir] |
Recursively search text in a directory |
grep -r 'error' /var/logs |
📦 Package Management with APT
Command |
Description |
Example |
sudo apt update |
Refresh list of available packages |
sudo apt update |
sudo apt upgrade |
Install updates for all installed packages |
sudo apt upgrade |
sudo apt install [package] |
Install a specific package |
sudo apt install vim |
sudo apt remove [package] |
Uninstall a specific package |
sudo apt remove vim |
dpkg -i [file.deb] |
Manually install a .deb package |
dpkg -i mypackage.deb |
Command |
Description |
Example |
chmod [mode] [file] |
Change permissions (rwx) for a file |
chmod 755 script.sh |
chown [user]:[group] [file] |
Change ownership of a file or directory |
chown root:staff file.txt |
chown -R [user]:[group] [dir] |
Change ownership for directory and contents |
chown -R user:user /project |
Example of Permissions with chmod
Each number in chmod
represents permissions for Owner, Group, and Others:
Number |
Permissions |
Meaning |
7 |
rwx |
Read, Write, Execute |
5 |
r-x |
Read, Execute |
6 |
rw- |
Read, Write |
4 |
r-- |
Read only |
chmod 755 file.sh
→ Owner has full access (7
= rwx
); group and others can read and execute (5
= r-x
).
chmod 644 file.sh
→ Owner can read and write (6
= rw-
); group and others can only read (4
= r--
).
Command |
Description |
Example |
top |
Monitor running processes in real-time |
top |
htop |
Colorized view of running processes |
htop |
df -h |
Show disk usage in human-readable format |
df -h |
du -sh [directory] |
Show size of a directory |
du -sh /home |
free -h |
Show memory usage |
free -h |
uname -a |
Display system information |
uname -a |
ps aux |
Show all running processes |
ps aux |
Command |
Description |
Example |
ifconfig |
Show network interface configuration |
ifconfig |
ip a |
List IP addresses of interfaces |
ip a |
ping [host] |
Check connectivity to a host |
ping google.com |
netstat -tuln |
List open ports |
netstat -tuln |
curl [URL] |
Fetch data from a URL |
curl http://example.com |
wget [URL] |
Download files from a URL |
wget http://example.com/file.zip |
💾 File Compression and Archiving
Command |
Description |
Example |
tar -cvf archive.tar [dir] |
Create a .tar archive of a directory |
tar -cvf backup.tar /data |
tar -xvf archive.tar |
Extract contents of a .tar archive |
tar -xvf backup.tar |
gzip [file] |
Compress a file |
gzip file.txt |
gunzip [file.gz] |
Decompress a .gz file |
gunzip file.txt.gz |
zip [archive.zip] [file] |
Compress files into a .zip archive |
zip archive.zip file.txt |
unzip [archive.zip] |
Extract contents of a .zip file |
unzip archive.zip |
Command |
Description |
Example |
kill [PID] |
Terminate a process by its ID |
kill 1234 |
pkill [name] |
Terminate a process by name |
pkill firefox |
bg |
Move a job to the background |
bg |
fg |
Bring a background job to the foreground |
fg |
jobs |
List background jobs |
jobs |
Command |
Description |
Example |
crontab -e |
Edit the current user’s cron jobs |
crontab -e |
Cron syntax |
* * * * * command (min, hour, day, month, weekday) |
*/5 * * * * /script.sh |
Command |
Description |
Example |
ssh user@host |
Connect to a remote system |
ssh user@192.168.1.10 |
scp [source] user@host:[dest] |
Copy files to a remote system |
scp file.txt user@192.168.1.10:/path |
rsync -av [source] [dest] |
Sync files between local and remote systems |
rsync -av /local user@host:/remote |