Kali Linux Command Reference: Basic to Intermediate Shell
Posted on Dec 19, 2025 in Computers
This cheat sheet covers essential commands for system navigation, file management, user administration, and networking in Kali Linux, spanning foundational concepts (Lessons 1-2) and more advanced topics (Lessons 3-4).
System Information and Navigation
| Concept | Command / Info | Key Point |
|---|
| OS Info | uname -a | Show kernel, version, and architecture |
| Hostname | hostname | Show the system’s hostname (L3-4) |
| List files | ls, ls -l, ls -als | -l = detailed listing, -a = show hidden files |
| Manual | man <cmd> | View command help documentation (L1-2) |
| Clear screen | clear | Same as cls in Windows (L1-2) |
| Current directory | pwd | Show current working directory |
| Move directories | cd <dir>, cd .., cd ~ | Move to directory / go up one level / go home |
| Make directory | mkdir <dir> | Create a new folder |
| Rename / Move | mv <src> <dst> | Rename or move files/directories |
| Delete file/directory | rm -r <dir> | Remove directory and its contents recursively |
| Copy file | cp <src> <dst> | Duplicate a file |
Files and Editing
| Concept | Command / Info | Key Point |
|---|
| View file | cat <file> | Display the entire file contents |
| Create text | echo "text" > file.txt | Write text to a file (no editor needed) |
| Edit text | nano <file> | Open the Nano text editor |
| Search text | grep "word" <file> | Find a keyword within a file |
| Page output | more <file> | Scroll forward one page at a time (L3-4) |
| Advanced paging | less <file> | Scroll forward/backward, search capabilities (L3-4) |
| Pipe output | <cmd1> | <cmd2> | Pass output of command 1 as input to command 2 |
| Archive files | tar cvzf <file>.tar.gz <folder> | Create compressed tar.gz archive (L3-4) |
| Extract archive | tar xvzf <file>.tar.gz | Extract tar.gz file (x=extract, v=verbose, z=gzip, f=filename) (L3-4) |
| Zip files | zip <archive>.zip * | Compress all files in current directory into a zip (L3-4) |
| Unzip files | unzip <archive>.zip | Extract contents of a zip file (L3-4) |
Users and Privileges
| Concept | Command / Info | Key Point |
|---|
| Add user | adduser <name> | Create a new user account (L1-2) |
| View user info | id <user> | Show User ID (UID), Group ID (GID), and groups |
| Default UIDs | kali=1000, new=1001+ | UIDs assigned in creation order (L1-2) |
| Logged-in user | whoami | Shows the currently logged-in user |
| Add sudo rights | sudo usermod -aG sudo <user> | Grant administrative access (add user to sudo group) (L1-2) |
| Check sudo access | id <user> | Should list the sudo group membership |
| Become root | sudo -s | Obtain a temporary administrative shell |
| Root prompt indicator | # | Indicates you are running as the root user (L1-2) |
| New terminal security | Opens as user again | Security measure: no persistent root session (L1-2) |
| Security practice | Use sudo when needed | Prevents system damage or accidental malware execution (L1-2) |
Passwords and Policies
| Concept | Command / Info | Key Point |
|---|
| View policy | chage <user> | Show password aging settings |
| Password file | /etc/shadow | Stores password hashes and expiry information |
| Hash type | yescrypt | Hashing algorithm used for user passwords |
| Max days | 99999 | Password validity period |
| Last change | e.g., 20186 | Days since 1 Jan 1970 (e.g., 18 Oct 2024) |
Processes and Monitoring
| Concept | Command / Info | Key Point |
|---|
| View network connections | netstat -ap | Show all TCP/UDP connections, PID, and program name |
| Follow output | tail -f <file> | Show last lines and monitor file in real-time |
| Stop command | Ctrl + C | Quit tail or stop any running foreground command |
| CPU info | cat /proc/cpuinfo | Shows processor details |
| Memory info | cat /proc/meminfo | Shows RAM usage and statistics |
Networking
| Concept | Command / Info | Key Point |
|---|
| Network info | ip address | Show network interfaces and IP addresses |
| Legacy command | ifconfig | Deprecated, may require installing net-tools package |
| Check host connectivity | ping <IP> | Test network reachability to a host |
| Windows network info | ipconfig | Show IP configuration in a Windows host |
Scripting
| Concept | Command / Info | Key Point |
|---|
| Bash script | .sh | File extension for Shell scripting |
| Python script | .py | File extension for Python scripting |
| Perl script | .pl | File extension for Perl scripting |
| Run script | ./script.sh | Execute if executable permission is set |
| Shebang line | #!/bin/bash | Specifies the interpreter, required to run script directly |