Basic Linux Commands

13/10/2025

πŸ—‚ File and Directory Navigation

CommandDescriptionExample
pwdPrint current working directorypwd
lsList files and directoriesls -l
cdChange directorycd Documents
treeShow directories as a tree (if installed)Print the current working directory

πŸ“ File and Directory Management

CommandDescriptionExample
touchCreate an empty filetouch file.txt
mkdirCreate a new directorymkdir new_folder
cpCopy files or directoriescp file.txt copy.txt
mvMove or rename files/directoriesmv file.txt folder/
rmRemove filesrm file.txt
rm -rRemove directories recursivelyrm -r folder

πŸ“– Viewing and Editing Files

CommandDescriptionExample
catView contents of a filecat file.txt
lessView the first lines of a fileless longfile.txt
headView the last lines of a filehead -n 10 file.txt
tailView last lines of a filetail -n 10 file.txt
nano / vimEdit files in the terminalView the file page by page

βš™οΈ System and Process Management

CommandDescriptionExample
whoamiShow current logged userwhoami
uname -aShow system informationuname -a
top or htopShow running processestop
psShow your running processesps aux
killKill a process by PIDkill 1234
shutdownShow the current logged userShut down the system

🌐 Networking Commands

CommandDescriptionExample
pingCheck network connectivityping google.com
ifconfig / ip aShow network interfacesip a
curlFetch data from a URLcurl https://example.com
wgetDownload files from the webwget https://example.com/file.zip

πŸ” Searching and Finding

CommandDescriptionExample
findSearch for files and directoriesfind . -name file.txt
grepSearch text in filesgrep "word" file.txt
locateQuickly find file paths (uses a database)locate file.txt