Penukar Percuma

Linux / Bash Lembaran Cheat Perintah

Helaian cheat arahan Linux dan Bash yang komprehensif. Cari 80+ perintah penting dengan contoh, penerangan dan salinan satu klik.

ls
List directory contents
Contoh:ls -la /home/user
ls -la
List all files including hidden, with details
Contoh:ls -la ~/Documents
cd
Change directory
Contoh:cd /var/log
pwd
Print working directory path
Contoh:pwd
mkdir
Create a new directory
Contoh:mkdir -p /tmp/mydir/subdir
rm
Remove files or directories
Contoh:rm -rf /tmp/oldfiles
cp
Copy files or directories
Contoh:cp -r /src/dir /dst/dir
mv
Move or rename files/directories
Contoh:mv oldname.txt newname.txt
touch
Create an empty file or update timestamp
Contoh:touch newfile.txt
find
Search for files in a directory hierarchy
Contoh:find /home -name '*.log' -mtime -7
locate
Find files by name using a prebuilt database
Contoh:locate nginx.conf
ln
Create hard or symbolic links
Contoh:ln -s /path/to/target /path/to/link
df
Report disk space usage of file systems
Contoh:df -h
du
Estimate file space usage
Contoh:du -sh /var/log/*
stat
Display file or file system status
Contoh:stat /etc/passwd
file
Determine file type
Contoh:file /usr/bin/bash
cat
Concatenate and display file contents
Contoh:cat /etc/hosts
less
View file content one screen at a time
Contoh:less /var/log/syslog
more
View file content page by page
Contoh:more /etc/passwd
head
Output the first part of a file
Contoh:head -n 20 /var/log/auth.log
tail
Output the last part of a file
Contoh:tail -f /var/log/syslog
grep
Search text using patterns
Contoh:grep -rn 'error' /var/log/
sed
Stream editor for filtering and transforming text
Contoh:sed 's/old/new/g' file.txt
awk
Pattern scanning and text processing language
Contoh:awk '{print $1, $3}' access.log
sort
Sort lines of text files
Contoh:sort -k2 -n data.txt
uniq
Report or omit repeated lines
Contoh:sort file.txt | uniq -c
wc
Print newline, word, and byte counts
Contoh:wc -l /etc/passwd
cut
Remove sections from each line of files
Contoh:cut -d: -f1 /etc/passwd
tr
Translate or delete characters
Contoh:echo 'hello' | tr 'a-z' 'A-Z'
echo
Display a line of text
Contoh:echo "Hello, World!"
printf
Format and print data
Contoh:printf "%s\t%d\n" name 42
diff
Compare files line by line
Contoh:diff file1.txt file2.txt
tee
Read from stdin and write to stdout and files
Contoh:ls | tee output.txt
ps
Report a snapshot of current processes
Contoh:ps aux | grep nginx
top
Display Linux processes in real time
Contoh:top -u www-data
htop
Interactive process viewer (ncurses-based)
Contoh:htop
kill
Send a signal to a process
Contoh:kill -9 1234
killall
Kill processes by name
Contoh:killall firefox
bg
Resume a suspended job in the background
Contoh:bg %1
fg
Bring a job to the foreground
Contoh:fg %1
jobs
List active jobs in the current shell
Contoh:jobs -l
nohup
Run a command immune to hangups
Contoh:nohup ./script.sh &
nice
Run a command with modified scheduling priority
Contoh:nice -n 10 ./heavy_task.sh
systemctl
Control the systemd system and service manager
Contoh:systemctl restart nginx
service
Run a System V init script
Contoh:service apache2 status
ping
Send ICMP ECHO_REQUEST to network hosts
Contoh:ping -c 4 google.com
curl
Transfer data from or to a server
Contoh:curl -L -o file.zip https://example.com/file.zip
wget
Non-interactive network downloader
Contoh:wget -q https://example.com/file.tar.gz
ssh
OpenSSH remote login client
Contoh:ssh -i ~/.ssh/key.pem user@host
scp
Secure copy files between hosts
Contoh:scp user@host:/path/file.txt ./local/
rsync
Remote file copying tool with delta transfer
Contoh:rsync -avz /src/ user@host:/dst/
netstat
Print network connections and routing tables
Contoh:netstat -tulpn
ss
Utility to investigate sockets
Contoh:ss -tulwn
ifconfig
Configure a network interface
Contoh:ifconfig eth0
ip
Show and manipulate routing, devices, and tunnels
Contoh:ip addr show
nmap
Network exploration tool and port scanner
Contoh:nmap -sV 192.168.1.0/24
dig
DNS lookup utility
Contoh:dig +short A google.com
nslookup
Query Internet name servers interactively
Contoh:nslookup example.com
chmod
Change file mode bits (permissions)
Contoh:chmod 755 script.sh
chown
Change file owner and group
Contoh:chown -R www-data:www-data /var/www
chgrp
Change group ownership
Contoh:chgrp developers project/
sudo
Execute a command as another user (superuser)
Contoh:sudo systemctl restart nginx
su
Change user ID or become superuser
Contoh:su - postgres
passwd
Change user password
Contoh:passwd username
umask
Set or display the file mode creation mask
Contoh:umask 022
id
Print user and group information
Contoh:id username
whoami
Print the current effective user name
Contoh:whoami
groups
Print the groups a user is in
Contoh:groups username
tar
Archive files using tape archive format
Contoh:tar -czvf archive.tar.gz /path/to/dir
tar -x
Extract files from a tar archive
Contoh:tar -xzvf archive.tar.gz -C /target/
gzip
Compress files using GNU zip
Contoh:gzip -9 large_file.log
gunzip
Decompress gzip compressed files
Contoh:gunzip archive.tar.gz
zip
Package and compress files into a ZIP archive
Contoh:zip -r output.zip /path/to/dir
unzip
Extract files from a ZIP archive
Contoh:unzip archive.zip -d /target/
bzip2
Compress files using bzip2 algorithm
Contoh:bzip2 -z large_file.txt
xz
Compress files using the XZ algorithm
Contoh:xz -z -9 file.txt
uname
Print system information
Contoh:uname -a
uptime
Tell how long the system has been running
Contoh:uptime
free
Display amount of free and used memory
Contoh:free -h
lscpu
Display information about the CPU architecture
Contoh:lscpu
lsblk
List information about block devices
Contoh:lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
lspci
List all PCI devices
Contoh:lspci -v | grep VGA
dmesg
Print or control the kernel ring buffer
Contoh:dmesg | tail -50
journalctl
Query and display messages from the journal
Contoh:journalctl -u nginx --since '1 hour ago'
history
Display the command history list
Contoh:history | grep docker
env
Print environment variables
Contoh:env | grep PATH
if / then / fi
Conditional execution in shell scripts
Contoh:if [ -f file.txt ]; then echo exists; fi
for
Loop over a list of items
Contoh:for i in 1 2 3; do echo $i; done
while
Execute commands while a condition is true
Contoh:while read line; do echo $line; done < file
case
Multi-branch conditional matching pattern
Contoh:case "$var" in a) echo A;; b) echo B;; esac
function
Define a shell function
Contoh:greet() { echo "Hello, $1!"; }; greet World
export
Set environment variables for child processes
Contoh:export MY_VAR=value
source
Execute commands from a file in current shell
Contoh:source ~/.bashrc
alias
Create an alias for a command
Contoh:alias ll='ls -la'
cron / crontab
Schedule commands to run periodically
Contoh:crontab -e # 0 * * * * /path/to/script.sh
at
Execute commands at a specified time
Contoh:echo 'ls /tmp' | at 14:30

Tentang alat ini

Panduan rujukan pantas yang komprehensif untuk linux bash. Semak imbas arahan, sintaks dan contoh yang biasa digunakan yang disusun mengikut kategori. Boleh dicari dan mesra mudah alih — tandakan halaman ini untuk akses segera apabila anda memerlukan peringatan pantas.

Cara menggunakan

  1. Semak imbas bahagian rujukan yang dikategorikan.
  2. Gunakan bar carian untuk mencari arahan atau sintaks tertentu.
  3. Klik pada mana-mana entri untuk melihat contoh penggunaan dan penjelasan.
  4. Salin arahan terus untuk digunakan dalam terminal atau editor anda.

Soalan lazim

Adakah rujukan ini terkini?
Rujukan meliputi arahan dan sintaks yang digunakan secara meluas yang stabil merentas versi. Untuk penambahan terkini atau ciri khusus versi, semak dokumentasi rasmi.
Bolehkah saya menggunakan ini di luar talian?
Setelah dimuatkan, halaman berfungsi tanpa sambungan internet. Tandai halaman untuk akses pantas — semua kandungan dipaparkan dalam penyemak imbas tanpa permintaan rangkaian selanjutnya.
Adakah ini menyeluruh atau hanya asas?
Ia merangkumi arahan dan corak yang paling biasa digunakan yang mengendalikan 90% tugas harian. Untuk ciri khusus atau lanjutan, rujuk dokumentasi rasmi.
Bolehkah saya mencadangkan penambahan?
Kami sentiasa mengemas kini rujukan kami. Jika anda mendapati tiada arahan atau mempunyai cadangan, beritahu kami melalui halaman hubungan kami.