Kali Linux Command Reference: Basic to Intermediate Shell

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

ConceptCommand / InfoKey Point
OS Infouname -aShow kernel, version, and architecture
HostnamehostnameShow the system’s hostname (L3-4)
List filesls, ls -l, ls -als-l = detailed listing, -a = show hidden files
Manualman <cmd>View command help documentation (L1-2)
Clear screenclearSame as cls in Windows (L1-2)
Current directorypwdShow current working directory
Move directoriescd <dir>, cd .., cd ~Move to directory / go up one level / go home
Make directorymkdir <dir>Create a new folder
Rename / Movemv <src> <dst>Rename or move files/directories
Delete file/directoryrm -r <dir>Remove directory and its contents recursively
Copy filecp <src> <dst>Duplicate a file

Files and Editing

ConceptCommand / InfoKey Point
View filecat <file>Display the entire file contents
Create textecho "text" > file.txtWrite text to a file (no editor needed)
Edit textnano <file>Open the Nano text editor
Search textgrep "word" <file>Find a keyword within a file
Page outputmore <file>Scroll forward one page at a time (L3-4)
Advanced pagingless <file>Scroll forward/backward, search capabilities (L3-4)
Pipe output<cmd1> | <cmd2>Pass output of command 1 as input to command 2
Archive filestar cvzf <file>.tar.gz <folder>Create compressed tar.gz archive (L3-4)
Extract archivetar xvzf <file>.tar.gzExtract tar.gz file (x=extract, v=verbose, z=gzip, f=filename) (L3-4)
Zip fileszip <archive>.zip *Compress all files in current directory into a zip (L3-4)
Unzip filesunzip <archive>.zipExtract contents of a zip file (L3-4)

Users and Privileges

ConceptCommand / InfoKey Point
Add useradduser <name>Create a new user account (L1-2)
View user infoid <user>Show User ID (UID), Group ID (GID), and groups
Default UIDskali=1000, new=1001+UIDs assigned in creation order (L1-2)
Logged-in userwhoamiShows the currently logged-in user
Add sudo rightssudo usermod -aG sudo <user>Grant administrative access (add user to sudo group) (L1-2)
Check sudo accessid <user>Should list the sudo group membership
Become rootsudo -sObtain a temporary administrative shell
Root prompt indicator#Indicates you are running as the root user (L1-2)
New terminal securityOpens as user againSecurity measure: no persistent root session (L1-2)
Security practiceUse sudo when neededPrevents system damage or accidental malware execution (L1-2)

Passwords and Policies

ConceptCommand / InfoKey Point
View policychage <user>Show password aging settings
Password file/etc/shadowStores password hashes and expiry information
Hash typeyescryptHashing algorithm used for user passwords
Max days99999Password validity period
Last changee.g., 20186Days since 1 Jan 1970 (e.g., 18 Oct 2024)

Processes and Monitoring

ConceptCommand / InfoKey Point
View network connectionsnetstat -apShow all TCP/UDP connections, PID, and program name
Follow outputtail -f <file>Show last lines and monitor file in real-time
Stop commandCtrl + CQuit tail or stop any running foreground command
CPU infocat /proc/cpuinfoShows processor details
Memory infocat /proc/meminfoShows RAM usage and statistics

Networking

ConceptCommand / InfoKey Point
Network infoip addressShow network interfaces and IP addresses
Legacy commandifconfigDeprecated, may require installing net-tools package
Check host connectivityping <IP>Test network reachability to a host
Windows network infoipconfigShow IP configuration in a Windows host

Scripting

ConceptCommand / InfoKey Point
Bash script.shFile extension for Shell scripting
Python script.pyFile extension for Python scripting
Perl script.plFile extension for Perl scripting
Run script./script.shExecute if executable permission is set
Shebang line#!/bin/bashSpecifies the interpreter, required to run script directly