Semua alat
Gratis

Referensi Bash / shell yang dapat dicari dan dicetak — navigasi, file, pipe, variabel, loop, kondisional, dan one-liner praktis. Gratis.

Navigation

8
pwd
Print the working directory
ls -la
List all files with details
cd /path
Change directory
cd -
Go to the previous directory
cd ~
Go to the home directory
tree -L 2
Show directory tree (2 levels)
pushd / popd
Push and pop the directory stack
ls -lhS
List by size, human-readable

Files & directories

10
touch file.txt
Create an empty file
mkdir -p a/b/c
Create nested directories
cp -r src dest
Copy recursively
mv old new
Move or rename
rm -rf dir
Remove recursively (careful!)
ln -s target link
Create a symbolic link
cat file.txt
Print file contents
head -n 20 / tail -n 20
First / last 20 lines
tail -f log.txt
Follow a file as it grows
less file.txt
Page through a file

Search & find

8
grep 'pattern' file
Search for a pattern in a file
grep -rin 'text' .
Recursive, case-insensitive, numbered
find . -name '*.php'
Find files by name
find . -type f -mtime -1
Files modified in the last day
find . -size +10M
Files larger than 10 MB
which node
Locate an executable
locate file.txt
Find by indexed database
grep -v 'skip' file
Invert match (exclude lines)

Text processing

9
wc -l file
Count lines
sort file | uniq -c
Sort then count duplicates
cut -d',' -f1 file
Extract a CSV column
awk '{print $1}' file
Print the first field
sed 's/old/new/g' file
Substitute text
tr 'a-z' 'A-Z'
Translate characters
diff a.txt b.txt
Compare two files
tee out.txt
Write to a file and stdout
xargs -I{} cmd {}
Build commands from input

Pipes & redirection

9
a | b
Pipe output of a into b
cmd > file
Redirect stdout (overwrite)
cmd >> file
Redirect stdout (append)
cmd 2> err.log
Redirect stderr
cmd > out 2>&1
Redirect both streams
cmd < input.txt
Read stdin from a file
cmd1 && cmd2
Run cmd2 only if cmd1 succeeds
cmd1 || cmd2
Run cmd2 only if cmd1 fails
cmd &
Run in the background

Permissions & ownership

8
chmod 755 file
Set rwx for owner, rx for others
chmod +x script.sh
Make a file executable
chmod -R 644 dir
Recursive permission change
chown user:group file
Change owner and group
umask 022
Default permission mask
sudo cmd
Run a command as root
stat file
Show file metadata
ls -l file
View permission bits

Processes & system

9
ps aux
List running processes
top / htop
Live process monitor
kill -9 PID
Force-kill a process
pkill -f name
Kill processes by name
jobs / fg / bg
Manage background jobs
df -h
Disk space usage
du -sh dir
Size of a directory
free -h
Memory usage
uname -a
System and kernel info

Variables & expansion

9
NAME='value'
Set a variable (no spaces)
echo \"$NAME\"
Use a variable
export PATH=\"$PATH:/x\"
Export to child processes
$(command)
Command substitution
${VAR:-default}
Default if unset
$1 $2 $@
Script positional arguments
$?
Exit status of the last command
read -p 'Name: ' x
Read user input
echo {1..5}
Brace expansion

Scripting

9
#!/usr/bin/env bash
Shebang line
set -euo pipefail
Safer strict mode
if [ -f file ]; then ...; fi
Conditional on a file test
[ \"$a\" = \"$b\" ]
String comparison
for f in *.txt; do ...; done
Loop over files
while read line; do ...; done < file
Read a file line by line
case \"$x\" in a) ...;; esac
Multi-way branch
function greet() { echo hi; }
Define a function
trap cleanup EXIT
Run a handler on exit

Tidak ada entri yang cocok dengan “:q”.


Tentang Lembar Contekan Shell

Contekan Bash dan shell ini mencakup command line dari langkah pertama hingga scripting: navigasi, file dan direktori, pencarian dan find, pemrosesan teks, pipe dan redirection, izin dan kepemilikan, proses dan info sistem, variabel dan expansion, serta konstruksi shell scripting.

Dokumen ini memadukan perintah sehari-hari — ls, cp, grep, find, chmod, ps — dengan flag yang membuatnya berguna, ditambah sintaks pipe, redirection, dan expansion yang mengubah perintah tunggal menjadi one-liner. Bagian scripting mengingatkan Anda kembali pada sintaks loop, kondisional, dan fungsi saat Anda menulis script hanya dua kali setahun.

Semuanya ada di satu halaman gratis berbasis client-side: pencarian menyaring baris secara langsung, daftar isi yang sticky memudahkan lompat antar bagian, satu klik menyalin perintah apa pun, dan tombol cetak memberi Anda referensi terminal untuk meja kerja.

Cara menggunakan Lembar Contekan Shell

  1. Jelajahi bagian-bagiannya, mulai dari Navigasi dan File & direktori hingga Pipes & redirection dan Scripting.
  2. Ketik nama perintah seperti grep atau chmod ke kotak pencarian untuk menyaring lembar contekan secara instan.
  3. Lompat ke bagian seperti Pemrosesan teks melalui sidebar sticky.
  4. Klik sebuah perintah atau ikon salinnya untuk menyalinnya, lalu tempelkan ke terminal Anda.
  5. Cetak halaman ini untuk referensi perintah Bash secara offline.

Pertanyaan yang sering diajukan

Lembar contekan ini ditulis untuk Bash dan shell bergaya POSIX, sehingga hampir semuanya berfungsi tanpa perubahan di bash, zsh, dan shell serupa di Linux serta macOS.

Keduanya. Selain perintah file, pencarian, pemrosesan teks, dan proses, ada bagian khusus yang membahas variabel dan expansion plus konstruksi scripting — loop, kondisional, dan sintaks yang sering terlupa di antara satu script dengan script lainnya.

Bisa. Klik perintahnya atau ikon salin pada barisnya, dan perintah tersebut langsung tersimpan di clipboard Anda, siap ditempelkan ke terminal.

Selalu baca sebuah perintah sebelum menjalankannya, terutama yang melibatkan rm, izin akses, atau redirection. Setiap baris menyertakan deskripsi satu baris tentang apa yang dilakukan perintah tersebut.

Ya, sepenuhnya gratis — ini adalah halaman referensi berbasis client-side tanpa akun dan tanpa batasan.


Pencarian populer
linux commands cheat sheet bash cheat sheet shell commands list grep and find examples bash scripting reference chmod permissions cheat sheet pipes and redirection bash terminal commands list
Butuh bantuan?
Menemukan masalah dengan alat ini? Beri tahu tim kami.
Laporkan masalah

Tambahkan alat gratis ini ke situs web Anda sendiri — salin dan tempel kode di bawah ini.