Ecosystem PentestHint Academy Labs Trionyx
Cyber Security

Kali Linux Commands Explained: Complete Beginner to Advanced CLI Guide

Kali Linux is one of the most widely used operating systems in cybersecurity, penetration testing, ethical hacking, digital forensics, and security research. Whether you are starting your journey in cyber security or preparing for...

On this page
  1. 1. pwd – Print Working Directory
  2. 2. ls – List Files and Directories
  3. 3. cd – Change Directory
  4. 4. touch – Create Empty File
  5. 5. mkdir – Create Directory
  6. 6. rm – Remove Files or Directories
  7. 7. cp – Copy Files
  8. 8. mv – Move or Rename Files
  9. 9. cat – Display File Content
  10. 10. less – Read Large Files
  11. 11. head – Show Beginning of File
  12. 12. tail – Show End of File
  13. 13. find – Search Files
  14. 14. grep – Search Text
  15. 15. whoami – Current User
  16. 16. sudo – Execute as Root
  17. 17. chmod – Change Permissions
  18. 18. chown – Change Ownership
  19. 19. ifconfig
  20. 20. ping – Test Connectivity
  21. 21. netstat – Network Connections
  22. 22. ss – Socket Statistics
  23. 23. traceroute
  24. 24. nslookup – DNS Lookup
  25. 25. dig – Advanced DNS Queries
  26. 26. ps – Running Processes
  27. 27. top – System Monitoring
  28. 28. kill – Stop Process
  29. 29. apt update
  30. 30. apt upgrade
  31. 31. apt install
  32. 32. apt remove
  33. 33. zip
  34. 34. unzip
  35. 35. tar
  36. 36. df – Disk Space
  37. 37. du – Directory Usage
  38. 38. nmap – Network Scanning
  39. 39. curl – HTTP Requests
  40. 40. wget – Download Files
  41. 41. ssh – Secure Shell
  42. 42. scp – Secure File Copy
  43. 43. uname
  44. 44. hostname
  45. 45. uptime
  46. Learn Tab Completion
  47. Use History
  48. Clear Terminal
  49. Official Kali Linux Documentation

Kali Linux is one of the most widely used operating systems in cybersecurity, penetration testing, ethical hacking, digital forensics, and security research. Whether you are starting your journey in cyber security or preparing for advanced penetration testing, learning the Linux command line interface (CLI) is one of the most important skills.

In this guide, we will explore essential Kali Linux commands with explanations and examples so students can understand how Linux works internally and confidently navigate the terminal.

If you are completely new to Kali Linux, this article will help you understand:

  • File and directory management
  • User management
  • Networking commands
  • Package management
  • Permissions and ownership
  • Process management
  • Compression utilities
  • Monitoring and troubleshooting
  • Security and pentesting-related commands

Why Learn Kali Linux Commands?

Most cybersecurity tools work through the command line. Understanding Linux commands helps you:

  • Use security tools effectively
  • Automate tasks
  • Understand server environments
  • Perform penetration testing efficiently
  • Troubleshoot systems faster
  • Work in cloud and DevOps environments

Students preparing for:

  • CEH
  • PNPT
  • OSCP
  • Security+
  • eJPT
  • SOC Analyst roles
  • VAPT profiles

must learn Linux basics properly.


Understanding the Linux Terminal

The terminal is a text-based interface used to communicate with the operating system.

In Kali Linux, you can open the terminal using:

  • Ctrl + Alt + T

The terminal usually looks like:

user@kali:~$

Where:

  • user = current username
  • kali = hostname
  • ~ = home directory
  • $ = normal user
  • # = root user

Basic Kali Linux Navigation Commands

1. pwd – Print Working Directory

Displays the current directory path.

pwd

Example Output:

/home/kali

2. ls – List Files and Directories

Shows files and folders.

ls

Useful Options:

ls -l

Detailed view.

ls -a

Shows hidden files.

ls -la

Detailed + hidden files.


3. cd – Change Directory

Move between directories.

cd Downloads

Go back one directory:

cd ..

Go to home directory:

cd ~

File Management Commands

4. touch – Create Empty File

touch test.txt

Creates a file named test.txt.


5. mkdir – Create Directory

mkdir pentesthint

Creates a folder.

Create nested folders:

mkdir -p test/demo/lab

6. rm – Remove Files or Directories

Delete file:

rm file.txt

Delete folder recursively:

rm -r foldername

Force delete:

rm -rf foldername

Be careful with rm -rf.


7. cp – Copy Files

cp file1.txt backup.txt

Copy folders:

cp -r folder1 folder2

8. mv – Move or Rename Files

Rename:

mv old.txt new.txt

Move file:

mv file.txt /home/kali/Desktop/

File Viewing Commands

9. cat – Display File Content

cat notes.txt

10. less – Read Large Files

less access.log

Useful for log analysis.

Exit using:

q

11. head – Show Beginning of File

head file.txt

Default: first 10 lines.


12. tail – Show End of File

tail file.txt

Live log monitoring:

tail -f access.log

Very useful during security monitoring.


Search Commands

13. find – Search Files

Find a file:

find / -name password.txt

14. grep – Search Text

Search keyword inside files:

grep admin users.txt

Case insensitive:

grep -i admin users.txt

Recursive search:

grep -r password .

User and Permission Commands

15. whoami – Current User

whoami

16. sudo – Execute as Root

sudo apt update

Root privileges are required for administrative tasks.


17. chmod – Change Permissions

Example:

chmod 755 script.sh

Permission Meaning:

  • 7 = read + write + execute
  • 5 = read + execute

Make script executable:

chmod +x script.sh

18. chown – Change Ownership

sudo chown kali:kali file.txt

Networking Commands in Kali Linux

Networking commands are extremely important for penetration testers and SOC analysts.

19. ifconfig

Shows network interfaces.

ifconfig

Modern alternative:

ip a

20. ping – Test Connectivity

ping google.com

21. netstat – Network Connections

netstat -tulnp

Shows listening ports and services.


22. ss – Socket Statistics

Modern alternative to netstat.

ss -tulnp

23. traceroute

Track packet route.

traceroute google.com

Install if missing:

sudo apt install traceroute

24. nslookup – DNS Lookup

nslookup pentesthint.com

25. dig – Advanced DNS Queries

dig pentesthint.com

Process Management Commands

26. ps – Running Processes

ps aux

27. top – System Monitoring

top

Shows CPU and memory usage.

Better alternative:

htop

Install:

sudo apt install htop

28. kill – Stop Process

kill PID

Force kill:

kill -9 PID

Package Management Commands

29. apt update

Update package list.

sudo apt update

30. apt upgrade

Upgrade installed packages.

sudo apt upgrade

31. apt install

Install software.

sudo apt install nmap

32. apt remove

Remove package.

sudo apt remove nmap

Compression Commands

33. zip

Compress files.

zip archive.zip file.txt

34. unzip

Extract zip files.

unzip archive.zip

35. tar

Create tar archive:

tar -cvf backup.tar folder/

Extract:

tar -xvf backup.tar

Compressed tar.gz:

tar -czvf backup.tar.gz folder/

Disk and Storage Commands

36. df – Disk Space

df -h

37. du – Directory Usage

du -sh folder/

Useful Cybersecurity Commands

38. nmap – Network Scanning

nmap 192.168.1.1

Scan all ports:

nmap -p- target.com

Service detection:

nmap -sV target.com

Learn more from the official Nmap Documentation


39. curl – HTTP Requests

curl https://pentesthint.com

Fetch headers only:

curl -I https://pentesthint.com

40. wget – Download Files

wget https://example.com/file.zip

41. ssh – Secure Shell

Connect remote server:

ssh user@192.168.1.10

42. scp – Secure File Copy

scp file.txt user@192.168.1.10:/home/user/

System Information Commands

43. uname

System information:

uname -a

44. hostname

hostname

45. uptime

uptime

Shows system running time.


Kali Linux Tips for Beginners

Learn Tab Completion

Press TAB to auto-complete commands and file names.


Use History

View previous commands:

history

Run previous command:

!!

Clear Terminal

clear

Shortcut:

Ctrl + L

Common Linux Directory Structure

DirectoryPurpose
/homeUser files
/etcConfiguration files
/varLogs and variable data
/tmpTemporary files
/binEssential binaries
/usrUser programs
/rootRoot user directory

Best Way to Practice Linux Commands

The best learning approach is:

  1. Install Kali Linux in VirtualBox or VMware
  2. Practice daily commands
  3. Create files and folders manually
  4. Use TryHackMe and Hack The Box labs
  5. Learn bash scripting gradually

Recommended Learning Resources

Official Kali Linux Documentation

Kali Linux Official Website

Kali Linux Documentation


Internal PentestHint Resources

You can also explore:


Conclusion

Learning Kali Linux commands is one of the most important steps in cybersecurity. Almost every security assessment, server administration task, SOC investigation, cloud operation, and penetration testing activity depends on command-line knowledge.

Instead of memorizing commands blindly, try to understand:

  • What the command does
  • Why it is used
  • Real-world use cases
  • Security implications

The more you practice Linux commands daily, the more comfortable you will become with ethical hacking, VAPT, red teaming, and cyber defense operations.

Whether you want to become a penetration tester, SOC analyst, malware researcher, or cloud security engineer, mastering the Linux terminal will always give you a strong advantage.

Author

Chandan Ghodela

PentestHint contributor sharing practical cybersecurity research and education.

Keep reading

Related posts

Leave a Reply

Your email address will not be published. Required fields are marked *