COMMANDDESCRIPTIONEXAMPLE
pwdShow current directorypwd → /home/user/projects
lsList files and folders in current directoryls -la → lists all files with details
cd [directory]Change directorycd /var/log
mkdir [dir]Create a new directorymkdir myfolder
rmdir [dir]Remove an empty directoryrmdir myfolder
rm [file]Remove a filerm oldfile.txt
cp [src] [dest]Copy files o directoriescp file.txt backup/file.txt
touch [file]Create an empty filetouch newfile.txt
cat [file]show file contentcat /etc/passwd
head [file]Show first 10 lines of a filehead -n 5 access.log
tail [file]Show last 10 lines of a filetail -f /var/log/syslog (follow live)
nano [file], vim [file]edit a text file with nano or vimnano config.txt or vim script.sh
find [path] -name [file]Search a file by a namefind /home -name “*.jpg”
grep [pattern] [file]Search text pattern in filegrep “error” logfile.txt
wc -l [file]Count the number of lines in a filewc -l users.txt → 42 users.txt
uptimeShow how long the system has been runninguptime → 14:35 up 5 days, 3:12, 2 users
whoamiShow current userwhoami → john
whoShow who is loggedwho
idShow current user id and groupsid → uid=1000(john) gid=1000(john)…
sudo [command]Run the command as adminsudo apt update
su [user]Swith usersu – alice
passwd [user]Changes the passwordpasswd bob
ping [host]Test network connectionping google.com
ip aShow network interfaceip a
curl [url]Download the content of an URLcurl -O https://example.com/file.iso
ssh [user]@[host]Connect to remote machine via SSHssh john@192.168.1.100
apt install [package]Install packagesudo apt install nginx
apt remove [package]Remove packagesudo apt remove vim
chmod [perm] [file]Change file permissionschmod 755 script.sh
chown [user]:[group] [file]Change file ownersudo chown www-data:www-data /var/www/html
tar -cfv file.tar [dir]Create a tar archivetar -cvf backup.tar /home/user/docs
tar -xvf file.tarExtract a tar archivetar -xvf backup.tar
tar -czvf file.tar.gz [dir]Create compressed tar.gz archivetar -czvf backup.tar.gz /var/www
tar -xzvf file.tar.gzExtract compressed archivetar -xzvf backup.tar.gz
zip -r file.zipCreate a zip filezip -r archive.zip documents/
unzip file.zipExtract zip fileunzip archive.zip
psShow running processps aux
kill [PID]Kill process by PIDkill 12345 or kill -9 12345 (force)
historyShow command historyhistory
!nrun the command number n from history!123 (runs command #123)
!!Repeat the last command!! (useful with sudo: sudo !!)
Ctrl + cStop current command(press while a command is running)
man [command]Show a manual of specified commandman ls
echo [text]Prints text or variable contents to the terminal.echo “Hello World” or echo $PATH
wget [url]Downloads files from a URL.wget https://example.com/bigfile.zip
clearClears the terminal spaceclear
dateShows or sets the system date and timedate → Thu Nov 27 14:30:25 UTC 2025
stat [file]Shows detailed information about a file.stat report.pdf
git clone [repu_url]Clones a git repository.git clone https://github.com/torvalds/linux.git
whereisFind binary, source, and man page of a commandwhereis python