| Kategori |
Perintah |
Fungsi |
Contoh |
| Directory |
pwd |
Menampilkan lokasi directory saat ini |
pwd |
| Directory |
ls |
Menampilkan isi directory |
ls |
| Directory |
ls -la |
Menampilkan semua file termasuk hidden file |
ls -la |
| Directory |
cd |
Berpindah directory |
cd Documents |
| Directory |
cd .. |
Kembali ke directory sebelumnya |
cd .. |
| Directory |
cd ~ |
Masuk ke home directory |
cd ~ |
| Directory |
mkdir |
Membuat directory baru |
mkdir project |
| Directory |
mkdir -p |
Membuat directory beserta parent directory |
mkdir -p project/src/components |
| Directory |
rmdir |
Menghapus directory kosong |
rmdir project |
| Kategori |
Perintah |
Fungsi |
Contoh |
| File |
touch |
Membuat file kosong |
touch index.html |
| File |
cp |
Menyalin file |
cp file.txt backup.txt |
| File |
cp -r |
Menyalin directory beserta isinya |
cp -r project backup |
| File |
mv |
Memindahkan file atau directory |
mv file.txt Documents/ |
| File |
mv |
Mengubah nama file |
mv old.txt new.txt |
| Delete |
rm |
Menghapus file |
rm file.txt |
| Delete |
rm -r |
Menghapus directory beserta isinya |
rm -r project |
| Delete |
rm -rf |
Menghapus secara paksa tanpa konfirmasi |
rm -rf project |
| Read |
cat |
Menampilkan isi file |
cat file.txt |
| Read |
less |
Membaca file secara interaktif |
less file.txt |
| Read |
head |
Menampilkan bagian awal file |
head file.txt |
| Read |
tail |
Menampilkan bagian akhir file |
tail file.txt |
Hati-hati dengan rm -rf. Perintah ini dapat menghapus banyak data secara permanen.
| Kategori |
Perintah |
Fungsi |
Contoh |
| Permission |
chmod |
Mengubah permission file |
chmod 755 script.sh |
| Permission |
chmod +x |
Membuat file dapat dieksekusi |
chmod +x script.sh |
| Ownership |
chown |
Mengubah owner file |
sudo chown user file.txt |
| Group |
chgrp |
Mengubah group file |
sudo chgrp developers file.txt |
| Permission |
ls -l |
Melihat permission dan ownership |
ls -l |
| Root |
sudo |
Menjalankan perintah dengan hak administrator |
sudo apt update |
-rwxr-xr--
│││ │││ │││
│││ │││ └┴┴─ Others
│││ └┴┴───── Group
└┴┴───────── Owner
Nilai permission:
r = read (baca)
w = write (tulis)
x = execute (eksekusi)
Contoh:
Artinya:
| Target |
Permission |
| Owner |
rwx (baca, tulis, eksekusi) |
| Group |
r-x (baca, eksekusi) |
| Others |
r-x (baca, eksekusi) |
| Kategori |
Perintah |
Fungsi |
Contoh |
| Search |
find |
Mencari file atau directory |
find . -name "*.txt" |
| Search |
locate |
Mencari file berdasarkan database |
locate nginx.conf |
| Search |
which |
Menampilkan lokasi executable |
which python |
| Search |
whereis |
Mencari binary, source, dan manual |
whereis nginx |
| Search |
grep |
Mencari teks di dalam file |
grep "error" app.log |
| Search |
grep -r |
Mencari teks secara recursive |
grep -r "TODO" . |
Mencari semua file JavaScript dari directory saat ini.
Mencari kata database pada file-file di directory saat ini.
| Kategori |
Perintah |
Fungsi |
Contoh |
| Process |
ps |
Melihat process yang sedang berjalan |
ps |
| Process |
ps aux |
Melihat semua process |
ps aux |
| Monitor |
top |
Monitor process secara real-time |
top |
| Monitor |
htop |
Monitor process dengan interface interaktif |
htop |
| Process |
kill |
Menghentikan process berdasarkan PID |
kill 1234 |
| Process |
kill -9 |
Memaksa menghentikan process |
kill -9 1234 |
| Process |
pgrep |
Mencari PID berdasarkan nama process |
pgrep nginx |
| Process |
pkill |
Menghentikan process berdasarkan nama |
pkill nginx |
Gunakan kill -9 hanya jika proses tidak dapat dihentikan dengan cara normal.
| Kategori |
Perintah |
Fungsi |
Contoh |
| Disk |
df -h |
Melihat penggunaan disk |
df -h |
| Storage |
du -h |
Melihat ukuran file/directory |
du -h project |
| Storage |
du -sh |
Melihat total ukuran directory |
du -sh project |
| Disk |
lsblk |
Melihat block device dan disk |
lsblk |
| Disk |
mount |
Melihat atau memasang filesystem |
mount |
| Disk |
umount |
Melepas filesystem |
sudo umount /mnt/drive |
| Kategori |
Perintah |
Fungsi |
Contoh |
| Network |
ip addr |
Melihat IP address |
ip addr |
| Network |
ip route |
Melihat routing table |
ip route |
| Network |
ping |
Menguji koneksi ke host |
ping google.com |
| DNS |
nslookup |
Mengecek informasi DNS |
nslookup google.com |
| DNS |
dig |
Melakukan query DNS |
dig google.com |
| Port |
ss -tuln |
Melihat port yang sedang listening |
ss -tuln |
| HTTP |
curl |
Mengirim request HTTP |
curl https://example.com |
| Download |
wget |
Mendownload file dari internet |
wget https://example.com/file.zip |
| Kategori |
Perintah |
Fungsi |
Contoh |
| SSH |
ssh |
Login ke server melalui SSH |
ssh user@server |
| Copy |
scp |
Menyalin file melalui SSH |
scp file.txt user@server:/home/user/ |
| Copy |
rsync |
Sinkronisasi file dan directory |
rsync -av project/ user@server:/home/user/project/ |
| SSH Key |
ssh-keygen |
Membuat SSH key |
ssh-keygen -t ed25519 |
| SSH Key |
ssh-copy-id |
Menyalin public key ke server |
ssh-copy-id user@server |
ssh-keygen -t ed25519 -C "email@example.com"
Kemudian login:
Perintah package manager berbeda tergantung distribusi Linux yang digunakan.
| Kategori |
Perintah |
Fungsi |
Contoh |
| Package |
apt update |
Memperbarui informasi package |
sudo apt update |
| Package |
apt upgrade |
Mengupgrade package |
sudo apt upgrade |
| Package |
apt install |
Menginstall package |
sudo apt install nginx |
| Package |
apt remove |
Menghapus package |
sudo apt remove nginx |
| Package |
apt search |
Mencari package |
apt search nginx |
| Kategori |
Perintah |
Fungsi |
Contoh |
| Package |
dnf install |
Menginstall package |
sudo dnf install nginx |
| Package |
dnf update |
Memperbarui package |
sudo dnf update |
| Package |
dnf remove |
Menghapus package |
sudo dnf remove nginx |
| Kategori |
Perintah |
Fungsi |
Contoh |
| Package |
pacman -S |
Menginstall package |
sudo pacman -S nginx |
| Package |
pacman -Syu |
Update system |
sudo pacman -Syu |
| Package |
pacman -R |
Menghapus package |
sudo pacman -R nginx |
| Kategori |
Perintah |
Fungsi |
Contoh |
| Text |
cat |
Menampilkan isi file |
cat file.txt |
| Text |
grep |
Mencari teks |
grep "hello" file.txt |
| Text |
wc |
Menghitung baris, kata, dan karakter |
wc -l file.txt |
| Text |
cut |
Mengambil bagian tertentu dari teks |
cut -d: -f1 /etc/passwd |
| Text |
sort |
Mengurutkan teks |
sort names.txt |
| Text |
uniq |
Menghapus duplikasi berurutan |
uniq names.txt |
| Text |
sed |
Memproses dan memodifikasi teks |
sed 's/old/new/g' file.txt |
| Text |
awk |
Memproses teks berdasarkan kolom |
awk '{print $1}' file.txt |
| Kategori |
Perintah |
Fungsi |
Contoh |
| Archive |
tar -cvf |
Membuat archive |
tar -cvf backup.tar project/ |
| Archive |
tar -xvf |
Mengekstrak archive |
tar -xvf backup.tar |
| Compress |
tar -czvf |
Membuat .tar.gz |
tar -czvf backup.tar.gz project/ |
| Extract |
tar -xzvf |
Mengekstrak .tar.gz |
tar -xzvf backup.tar.gz |
| Zip |
zip |
Membuat ZIP |
zip -r project.zip project/ |
| Unzip |
unzip |
Mengekstrak ZIP |
unzip project.zip |
| Kategori |
Perintah |
Fungsi |
Contoh |
| User |
whoami |
Menampilkan user yang sedang aktif |
whoami |
| User |
id |
Melihat UID dan GID user |
id |
| User |
who |
Melihat user yang sedang login |
who |
| User |
adduser |
Membuat user baru |
sudo adduser budi |
| User |
userdel |
Menghapus user |
sudo userdel budi |
| Password |
passwd |
Mengubah password |
passwd |
| Group |
groupadd |
Membuat group baru |
sudo groupadd developers |
| Group |
usermod |
Mengubah konfigurasi user |
sudo usermod -aG developers budi |
| Kategori |
Perintah |
Fungsi |
Contoh |
| System |
uname -a |
Menampilkan informasi kernel dan system |
uname -a |
| OS |
cat /etc/os-release |
Menampilkan informasi distribusi Linux |
cat /etc/os-release |
| CPU |
lscpu |
Menampilkan informasi CPU |
lscpu |
| Memory |
free -h |
Melihat penggunaan RAM |
free -h |
| System |
uptime |
Melihat lama system berjalan |
uptime |
| Date |
date |
Menampilkan tanggal dan waktu |
date |
| User |
whoami |
Menampilkan user saat ini |
whoami |
| Host |
hostname |
Menampilkan nama komputer |
hostname |
Sebagian besar distro modern menggunakan systemd untuk mengelola service.
| Kategori |
Perintah |
Fungsi |
Contoh |
| Service |
systemctl status |
Melihat status service |
sudo systemctl status nginx |
| Service |
systemctl start |
Menjalankan service |
sudo systemctl start nginx |
| Service |
systemctl stop |
Menghentikan service |
sudo systemctl stop nginx |
| Service |
systemctl restart |
Restart service |
sudo systemctl restart nginx |
| Service |
systemctl enable |
Menjalankan service otomatis saat boot |
sudo systemctl enable nginx |
| Service |
systemctl disable |
Menonaktifkan auto-start service |
sudo systemctl disable nginx |
Kalau hanya ingin mengingat perintah Linux yang paling sering digunakan:
# Location
pwd
ls
cd
cd ..
# File & Directory
mkdir project
touch file.txt
cp file.txt backup.txt
mv file.txt Documents/
rm file.txt
# Search
find . -name "*.txt"
grep "keyword" file.txt
# Permission
chmod 755 script.sh
chmod +x script.sh
sudo chown user file.txt
# Process
ps aux
top
kill <PID>
# Disk
df -h
du -sh .
# Network
ip addr
ping google.com
curl https://example.com
ss -tuln
# SSH
ssh user@server
scp file.txt user@server:/home/user/
# Package — Ubuntu/Debian
sudo apt update
sudo apt upgrade
sudo apt install <package>
# Service
sudo systemctl status nginx
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
┌───────────────────────┐
│ Navigation │
│ pwd · ls · cd │
└───────────┬───────────┘
↓
┌───────────────────────┐
│ File Management │
│ mkdir · cp · mv · rm │
└───────────┬───────────┘
↓
┌───────────────────────┐
│ Permission │
│ chmod · chown · sudo │
└───────────┬───────────┘
↓
┌───────────────────────┐
│ Process │
│ ps · top · kill │
└───────────┬───────────┘
↓
┌───────────────────────┐
│ Network │
│ ip · ping · curl │
└───────────┬───────────┘
↓
┌───────────────────────┐
│ Remote │
│ ssh · scp · rsync │
└───────────────────────┘
Beberapa perintah Linux dapat menyebabkan kehilangan data atau perubahan system secara permanen.
| Perintah |
Risiko |
rm -rf |
Menghapus file/directory secara recursive dan paksa. |
rm -rf / |
Sangat berbahaya dan dapat menghancurkan system. |
chmod -R |
Dapat mengubah permission banyak file sekaligus. |
chown -R |
Dapat mengubah ownership seluruh directory. |
kill -9 |
Memaksa process berhenti tanpa cleanup normal. |
dd |
Dapat menimpa disk atau partition jika digunakan salah. |
mkfs |
Dapat memformat filesystem. |
Always check your command before pressing Enter.
Terutama saat menggunakan sudo, rm, dd, mkfs, chmod -R, dan chown -R.