2 min read 586 words Updated Sep 12, 2026 Created Sep 12, 2026
CommandPurposeExample / Notes
pwdShow the current working directorypwd
lsList files and directoriesls
ls -lList with detailed informationShows permissions, owner, size, modification time, etc.
ls -laDetailed list including hidden filesHidden files begin with .
cdChange directorycd /var/log
cd ..Move up one directory.. represents the parent directory
cd ~Go to your home directory~ represents your home directory
mkdirCreate a directorymkdir reports
mkdir -pCreate directories including missing parentsmkdir -p labs/nmap/results
touchCreate an empty file or update its timestamptouch notes.txt
cpCopy a filecp source.txt copy.txt
cp -rCopy a directory recursivelycp -r source/ backup/
mvMove or rename a file/directorymv old.txt new.txt
rmDelete a filerm file.txt
rm -rDelete a directory and its contentsrm -r directory/
rmdirDelete an empty directoryrmdir directory/
catPrint or combine file contentscat file.txt
lessView text one screen at a timeless file.txt
morePaginate text outputmore file.txt
headDisplay the first 10 lineshead file.txt
tailDisplay the last 10 linestail file.txt
tail -fContinuously display new lines added to a filetail -f /var/log/syslog — useful for logs
echoPrint text or variable valuesecho "Hello" or echo $PATH
fileIdentify a file's typefile suspicious.bin
stringsExtract printable strings from a filestrings suspicious.bin
xxdDisplay a file as hexadecimalxxd suspicious.bin
grepSearch text for a string or patterngrep "ERROR" logfile.txt
findFind files and directoriesfind /var/log -name "*.log"
whoamiDisplay the current usernamewhoami
idShow user and group IDs/membershipsid
unameDisplay system informationuname -a
hostnameDisplay the system hostnamehostname
chmodChange file permissionschmod +x script.sh
chownChange file owner/groupsudo chown user:group file.txt
sudoExecute a command with elevated privilegessudo apt update
manDisplay a command's manual pageman grep
historyDisplay command historyhistory
clearClear the terminal screenclear
wgetDownload files from a URLwget https://example.com/file.txt
curlTransfer data to/from URLscurl https://example.com
tarCreate or extract tar archivestar -xf archive.tar
zipCreate a ZIP archivezip archive.zip file.txt
unzipExtract a ZIP archiveunzip archive.zip
ipView/configure network interfaces and routesip addr or ip route
ssDisplay network sockets/connectionsss -tulpn
pingTest network reachabilityping 8.8.8.8