Navigating Linux starts with the terminal. Here are fundamental commands every beginner should know, with practical examples:
1. File & Directory Operations
-
pwd
Print current directory path.
$ pwd
→/home/user
-
ls
List directory contents.
$ ls -l
→ Detailed view (permissions, size) -
cd
Change directory.
$ cd Documents
→ Enter “Documents” folder -
mkdir
Create a directory.
$ mkdir new_folder
-
touch
Create an empty file.
$ touch file.txt
-
cp
Copy files/directories.
$ cp file.txt backup/
-
mv
Move/rename files.
$ mv old.txt new.txt
→ Renaming
$ mv file.txt ~/Documents/
→ Moving -
rm
Remove files/directories.
$ rm file.txt
→ Delete file
$ rm -r old_dir/
→ Delete directory (recursive) -
cat
Display file content.
$ cat notes.txt
-
head
/tail
Show first/last lines of a file.
$ tail -5 log.txt
→ Last 5 lines
2. System & Process Management
-
ps
List active processes.
$ ps aux
→ Detailed process list -
top
/htop
Monitor system resources (CPU, memory).
$ top
-
kill
Terminate processes.
$ kill 1234
→ End process with PID 1234 -
df
Check disk space.
$ df -h
→ Human-readable format -
free
Display memory usage.
$ free -m
→ Show in megabytes -
uname
Print system information.
$ uname -a
→ Kernel version, hardware
3. Text & Search Tools
-
grep
Search text patterns.
$ grep "error" log.txt
→ Find “error” in file -
find
Locate files/directories.
$ find /home -name "*.jpg"
→ Search .jpg files -
wc
Count lines/words/characters.
$ wc -l data.csv
→ Line count -
echo
Print text/variables.
$ echo $HOME
→ /home/user -
nano
/vim
Text editors.
$ nano file.txt
4. Networking
-
ping
Test network connectivity.
$ ping google.com
-
ifconfig
/ip
Configure network interfaces.
$ ip addr show
-
ssh
Connect to remote servers.
$ ssh user@192.168.1.10
-
wget
/curl
Download files.
$ wget https://example.com/file.zip
5. Permissions & Users
-
chmod
Change file permissions.
$ chmod 755 script.sh
→ User: rwx, Group/Others: rx -
chown
Change file owner.
$ chown user:group file.txt
-
sudo
Execute commands as superuser.
$ sudo apt update
-
passwd
Change user password.
$ passwd
6. Package Management
-
APT (Debian/Ubuntu)
$ sudo apt install nginx
→ Install package
$ sudo apt remove nginx
→ Remove package -
YUM/DNF (Fedora/CentOS)
$ sudo dnf install httpd
7. Compression & Archives
-
tar
Create/extract archives.
$ tar -czvf archive.tar.gz /folder/
→ Compress
$ tar -xzvf archive.tar.gz
→ Extract -
zip
/unzip
Handle .zip files.
$ unzip files.zip
8. Shortcuts & Help
-
man
Access command manuals.
$ man ls
-
history
View command history.
$ history | grep "ssh"
-
clear
Clean terminal screen.
$ clear
Pro Tips:
- Use
Tab
for auto-completion. - Chain commands with
|
(pipe):
$ cat log.txt | grep "warning" | wc -l
→ Count warnings - Combine commands with
&&
:
$ mkdir new && cd new
Master these to navigate Linux confidently! 🐧