Basic commands to use in the terminal
Updated on
2026-10-07 15:00:54
154
visits
In this manual, you will find the essential commands to navigate and work in the terminal of a GNU/Linux system. It is a quick reference for both beginners and technical users.
Prerequisites
- Access to a Linux server.
- Terminal connection (local or via SSH).
🚀 If you don't have a Linux server yet, you can easily deploy one with SW Hosting.
Navigation and file system
cd → Change directory
cd /
cd folder/subfolder
cd ..
pwd → Show current path
pwd
ls → List files
ls
ls *.txt
mkdir / rmdir → Create / delete directories
mkdir new_directory
rmdir new_directory
cp / mv → Copy and move files
cp file copy
mv file destination/
rm → Delete files
rm file
rm *
File viewing
cat, less, head, tail
cat file.txt
less file.txt
head file.txt
tail file.txt
tail -f log.txt
Permissions and owners
chmod → Change permissions
chmod 755 file
chmod u+x file
chown → Change owner
chown user:group file
chown -R user:group directory
System information
uname → System information
uname
uname -a
whoami → Current user
whoami
df / du → Disk usage
df -h
du -sh *
free → Memory usage
free -m
Search and filtering
find → Search for files
find -name file.txt
grep → Search inside files
grep 'text' file.txt
sort → Sort content
sort file.txt
Processes and system
ps → View processes
ps
ps -ef
kill → Terminate processes
kill PID
service → Manage services
service nginx start
service nginx stop
service nginx restart
Connectivity
ssh → Remote connection
ssh user@IP
ssh -p 2200 user@IP
Useful utilities
echo → Display text / write to file
echo 'Hello'
echo 'Hello' > file.txt
touch → Create empty file
touch file.txt
ln → Create link
ln file link
tar → Compress / decompress
tar cvf file.tar *.txt
tar xvf file.tar
watch → Run command periodically
watch -n5 'free -m'
Users and privileges
sudo → Run as administrator
sudo command
su → Switch user
su user
Terminal
clear → Clear screen
clear
Shortcut:
Ctrl + L
exit → Exit terminal
exit
💡 Practical tips
- Use the ↑ ↓ arrows to retrieve previous commands.
- Use
man commandto see help:
man ls
- Be careful with commands like
rm *orchmod 777.