When you first open a terminal in Kali Linux, the blinking cursor can feel like a blank canvas—or a wall of silence. Unlike a desktop environment, the command line gives you direct control over the system, and for security learners, it’s where the real education begins. Kali Linux ships with hundreds of pre-installed tools, but before you run any of them, you need to be comfortable with the commands that drive the operating system itself. This article covers the fundamental commands every beginner should know, with a focus on safe, legal practice in your own lab environment.
Navigating the File System
The first thing you’ll do in any Linux environment is move around directories. Kali uses a standard Linux filesystem hierarchy, so commands like pwd, ls, and cd are your bread and butter.
pwd– Prints the current working directory. Use it whenever you feel lost.ls -la– Lists all files (including hidden ones) with details like permissions, owner, size, and modification date. The-lflag gives a long listing;-ashows hidden files (those starting with a dot).cd /path/to/directory– Changes directory. Usecd ..to go up one level,cd ~to return to your home folder, andcd -to toggle back to the previous directory.
For example, after booting your Kali VM, type pwd and you’ll see /home/kali. Running ls -la will reveal hidden configuration files like .bashrc and .profile—understanding these will help you customize your shell later.

File Operations: Create, Copy, Move, Delete
You’ll constantly need to manipulate files when setting up lab environments or managing scripts. These commands are safe as long as you double-check the path before hitting Enter.
touch filename– Creates an empty file or updates the timestamp of an existing one.mkdir new_directory– Creates a new directory. Add-pto create nested directories in one go:mkdir -p labs/web/scanning.cp source destination– Copies files. Usecp -rfor directories (recursive copy). Example:cp -r /home/kali/labs /media/usb/backup-labs.mv source destination– Moves or renames files. It works like cut-and-paste.rm filename– Deletes a file. Warning: there is no trash bin. Userm -rto delete directories, but always double-check. A common beginner mistake isrm -rf /—never run that unless you’re ready to wipe your system.
For safety, consider aliasing rm to rm -i (interactive mode) in your .bashrc file. That way the system asks for confirmation before deleting each file.
Viewing and Editing Files
You don’t need a GUI to read or modify files. Kali includes several text editors and viewers.
cat filename– Dumps the entire file content to the terminal. Good for short files.less filename– Opens a file page by page. PressSpaceto scroll,qto quit. Ideal for logs or long configuration files.head -n 20 filename– Shows the first 20 lines.tail -n 20 filenameshows the last 20 lines. Useful for checking recent log entries.nano filename– A beginner-friendly terminal text editor. PressCtrl+Oto save,Ctrl+Xto exit. For more power, learnvim—but start with nano.
When editing system files like /etc/network/interfaces, always make a backup first: cp /etc/network/interfaces /etc/network/interfaces.bak.
User and Permission Management
Kali is typically used as root, but for learning it’s better to practice with a standard user account and use sudo only when necessary. This habit mirrors real-world secure administration.
whoami– Shows your current username.sudo command– Runs a command with superuser privileges. First-time users should runsudo -vto update the timestamp without executing a command.chmod 755 filename– Changes file permissions. The number755means owner can read/write/execute, group and others can read/execute. For a script you wrote, usechmod +x script.shto make it executable.chown user:group filename– Changes file ownership. Example:sudo chown kali:kali /opt/mytool.
Misunderstanding permissions is a common source of “permission denied” errors. Use ls -l to inspect the current permissions before changing them.
Networking Basics
Security learners need to understand network configuration and diagnostics. These commands help you check connectivity and interfaces without running any scanning tools.
ip a– Shows all network interfaces and their IP addresses. Replaces the olderifconfig(which may not be installed by default).ip route– Displays the routing table. You’ll see the default gateway, which is often your router’s IP.ping -c 4 8.8.8.8– Sends four ICMP echo requests to test connectivity. Stop withCtrl+Cif you omit the-cflag.ss -tuln– Lists all listening TCP and UDP ports with their numeric addresses. This is the modern replacement fornetstat. Use it to see what services are running on your machine.nslookup example.com– Queries DNS records. For more detail, usedig example.com.
Always run networking commands on your own lab network or with explicit permission. Scanning external hosts without authorization is illegal in most jurisdictions.

Process Management
When a tool hangs or consumes too many resources, knowing how to find and stop processes is essential.
ps aux– Shows all running processes with user, PID, CPU/memory usage, and command. Combine withgrep:ps aux | grep firefox.top– Real-time view of processes sorted by resource usage. Pressqto quit.htop(install withsudo apt install htop) is more colorful and user-friendly.kill PID– Sends the TERM signal to a process, asking it to stop gracefully. Usekill -9 PIDas a last resort (force kill).pkill process_name– Kills all processes matching the name. Example:pkill firefox.
Never kill system-critical processes (like init or systemd) unless you know exactly what you’re doing.
Package Management
Kali is based on Debian, so it uses APT. You’ll need to install additional tools, update the system, or remove packages.
sudo apt update– Refreshes the list of available packages from repositories.sudo apt upgrade– Upgrades all installed packages to the latest versions. Runsudo apt full-upgradeto handle dependency changes (common in Kali rolling releases).sudo apt install package_name– Installs a package. Example:sudo apt install nmap.sudo apt remove package_name– Removes a package but leaves configuration files. Usesudo apt purge package_nameto remove everything.apt search keyword– Searches for packages without needing root. Useful when you’re not sure of the exact name.
Kali’s repositories are tailored for security tools. If a tool isn’t found, check if it’s in the kali-rolling repository or if you need to add a third-party PPA (which is generally not recommended for beginners due to trust issues).
Basic Security Checks (in Your Lab Only)
Once you’re comfortable with the commands above, you can start using a few built-in utilities to inspect your own system’s security posture. Remember: only run these on machines you own or have explicit written permission to test.
nmap -sn 192.168.1.0/24– Performs a ping sweep to discover live hosts on your local network. The-snflag disables port scanning, making it a low-impact discovery method.nmap -sV localhost– Scans your own machine for open ports and service versions. Great for learning what services are exposed.tcpdump -i eth0– Captures packets on an interface. Usetcpdump -i eth0 -c 10to capture only 10 packets. Analyze the output to understand network protocols.wireshark– While not a command-line tool, you can launch it from the terminal. It provides a graphical interface for packet analysis. Install withsudo apt install wireshark.
For a deeper dive into network diagnostics, you might want to understand common browser-related errors. For instance, a misconfigured proxy or DNS setting can produce the ERR_NETWORK_CHANGED error in Chrome—knowing how to inspect your routing table with ip route and your DNS with dig will help you troubleshoot faster.
Putting It All Together: A Simple Lab Exercise
To cement these commands, try this safe exercise on your own Kali VM:
- Open a terminal and create a directory called
security_labin your home folder:mkdir ~/security_lab. - Change into that directory:
cd ~/security_lab. - Create a text file with a list of your lab’s IP addresses:
echo "192.168.1.10" > targets.txt. - Check the file content:
cat targets.txt. - Run a ping sweep on your local subnet (adjust the network range to match your VM’s network):
nmap -sn 192.168.1.0/24. Note which hosts respond. - Save the scan output to a file:
nmap -sn 192.168.1.0/24 > scan_results.txt. - View the last 10 lines of the results:
tail -n 10 scan_results.txt. - Clean up:
rm targets.txt scan_results.txtandrmdir ~/security_lab.
This exercise uses navigation, file creation, networking, redirection, and deletion—all without touching any external system. Repeat variations of this routine until the commands become second nature. The terminal in Kali Linux is not a place to fear; it’s a workshop where each command is a tool you can sharpen with practice.
