mdwn (MENDOAN): 48 Linux Command Menus in One Tool
mdwn turns dozens of Linux commands into one tidy terminal menu. Here is what every menu does, plus an interactive browser demo you can try safely.
Read article →There are hundreds of commands in Linux and most of them rarely get used. This article gathers more than 150 commands you need every day — from moving around folders and managing files, to monitoring processes and configuring networks — each with a copy-ready example. Many of them are also available as a handy menu in mdwn.
Each section is a two-column table: an example command with its options, and a short explanation of what it does. All examples use Bash on Ubuntu/Debian — swap in your own file names, addresses, or ports as needed. Commands starting with sudo require administrator rights, so make sure you understand their effect before running them.
| Example command | Purpose |
|---|---|
pwd |
Show the path of the current directory. |
ls |
List the contents of a directory. |
ls -lah |
List everything including hidden files, with human-readable sizes. |
cd /var/www |
Change into a specific directory. |
cd .. |
Go up one level to the parent directory. |
cd ~ |
Return to the user's home directory. |
cd - |
Jump back to the previous directory. |
tree -L 2 |
Show the folder structure two levels deep. |
realpath index.php |
Print the absolute path of a file. |
basename /var/www/app.log |
Extract the file name from a path. |
| Example command | Purpose |
|---|---|
cat file.txt |
Print the whole file. |
less file.txt |
Read a file page by page with search. |
head -n 20 file.txt |
Show the first 20 lines. |
tail -n 20 file.txt |
Show the last 20 lines. |
tail -f app.log |
Follow new lines of a log file live. |
nl file.txt |
Print the file with line numbers. |
wc -l file.txt |
Count the number of lines. |
file dokumen.pdf |
Guess the type of a file. |
stat file.txt |
Show file metadata: size, permissions, and times. |
xxd file.bin |
Show the file contents in hexadecimal. |
| Example command | Purpose |
|---|---|
touch baru.txt |
Create a new empty file. |
mkdir -p a/b/c |
Create a directory and its parents in one go. |
cp asal.txt tujuan.txt |
Copy a file. |
cp -r folder1 folder2 |
Copy a directory with all of its contents. |
mv asal.txt tujuan.txt |
Move or rename a file. |
rm file.txt |
Delete a file. |
rm -rf folder |
Delete a directory and its contents without confirmation. |
rmdir folder |
Delete an empty directory. |
ln -s /var/www/app app |
Create a symbolic link. |
mktemp |
Create a safe temporary file. |
| Example command | Purpose |
|---|---|
nano file.txt |
Edit a file with the Nano editor. |
vim file.txt |
Edit a file with Vim. |
sed -i 's/lama/baru/g' file.txt |
Replace text inside a file in place. |
| Example command | Purpose |
|---|---|
find /var/log -name "*.log" |
Find files by name. |
find . -type d |
Find every directory under the current folder. |
find . -mtime -1 |
Find files changed in the last 24 hours. |
find . -size +100M |
Find files larger than 100 MB. |
locate nginx.conf |
Find a file through the locate database. |
which php |
Show the path of the command that will run. |
type ls |
Explain how the shell interprets a name. |
grep "error" app.log |
Search for lines containing a word. |
grep -ri "todo" . |
Search text across all files recursively. |
grep -c "GET" access.log |
Count the matching lines. |
zgrep "error" app.log.gz |
Search inside a compressed file. |
| Example command | Purpose |
|---|---|
sort file.txt |
Sort the lines of a file. |
sort -u file.txt |
Sort and remove duplicate lines. |
sort -rn angka.txt |
Sort numbers from largest to smallest. |
uniq -c |
Count how many times each line repeats. |
cut -d: -f1 /etc/passwd |
Extract a column using a delimiter. |
tr 'a-z' 'A-Z' |
Turn lowercase into uppercase. |
sed -n '1,10p' file.txt |
Print lines 1 through 10. |
awk '{print $1}' file.txt |
Print the first column of every line. |
awk -F: '{print $1}' /etc/passwd |
Set a delimiter, then print a specific column. |
paste a.txt b.txt |
Merge two files side by side. |
diff a.txt b.txt |
Compare two files line by line. |
split -l 1000 big.txt part_ |
Split a large file every 1000 lines. |
rev file.txt |
Reverse the characters of every line. |
| Example command | Purpose |
|---|---|
chmod 644 file.txt |
Set read/write for the owner and read for others. |
chmod +x script.sh |
Grant execute permission on a file. |
chmod -R 755 public/ |
Set directory permissions recursively. |
chown user:group file.txt |
Change a file's owner and group. |
sudo chown -R www-data:www-data /var/www |
Change ownership of a web directory. |
chgrp staff file.txt |
Change only the file's group. |
umask |
Show the permission mask for new files. |
sudo -i |
Open a shell as root. |
su - user |
Switch to another user with their environment. |
getfacl file.txt |
Show a file's ACL (access control list). |
| Example command | Purpose |
|---|---|
ps aux |
Show every running process. |
ps -ef |
Show processes in full format. |
top |
Monitor processes and resources live. |
htop |
A friendlier interactive process monitor. |
pgrep nginx |
Find a process PID by name. |
kill 1234 |
Stop a process by PID. |
kill -9 1234 |
Force-stop a process. |
killall nginx |
Stop every process with the same name. |
pkill -f "php artisan" |
Stop processes matching a command pattern. |
nice -n 10 tar -czf a.tar.gz bigfolder |
Run a command at a lower priority. |
renice -n 5 -p 1234 |
Change a running process's priority. |
nohup php artisan queue:work & |
Keep a process alive after the terminal closes. |
jobs |
List the jobs in the current shell. |
fg 1 |
Bring job number 1 back to the foreground. |
time ls |
Measure how long a command takes. |
timeout 10 curl https://canggihapp.com |
Limit how long a command may run. |
| Example command | Purpose |
|---|---|
df -h |
Show space usage of each filesystem. |
du -sh folder |
Show the total size of a folder. |
du -h --max-depth=1 . |
Show the size of each subfolder one level deep. |
lsblk |
List disks and their partitions. |
free -h |
Show memory and swap usage. |
swapon --show |
List the active swap. |
mount |
Show the mounted filesystems. |
sudo mount /dev/sdb1 /mnt/usb |
Mount a device to a folder. |
umount /mnt/usb |
Unmount a device. |
blkid |
Show UUIDs and filesystem types. |
sudo fdisk -l |
Show the partition table. |
sudo dd if=/dev/sda of=/backup.img bs=4M status=progress |
Copy a disk or make a raw image. |
| Example command | Purpose |
|---|---|
tar -czvf arsip.tar.gz folder/ |
Create a tar.gz archive. |
tar -xzvf arsip.tar.gz |
Extract a tar.gz archive. |
tar -tzf arsip.tar.gz |
List an archive's contents without extracting. |
gzip file.txt |
Compress a file into .gz. |
gunzip file.txt.gz |
Decompress a .gz file. |
zip -r arsip.zip folder/ |
Create a ZIP archive recursively. |
unzip arsip.zip -d tujuan/ |
Extract a ZIP into a destination folder. |
xz -9 file.txt |
Compress with the highest xz ratio. |
| Example command | Purpose |
|---|---|
ip a |
Show the IP address of each interface. |
ip r |
Show the routing table. |
ping -c 3 canggihapp.com |
Test connectivity with three packets. |
traceroute canggihapp.com |
Trace the packet route to a host. |
mtr canggihapp.com |
A live mix of ping and traceroute. |
ss -tulpn |
Show listening sockets and ports. |
netstat -tulpn |
Connection and port info the old way. |
dig canggihapp.com |
Run a full DNS query. |
nslookup canggihapp.com |
A simple DNS query. |
host canggihapp.com |
Resolve a domain to an IP address. |
curl -I https://canggihapp.com |
Fetch the HTTP headers only. |
curl -O https://example.com/file.zip |
Download a file keeping its name. |
wget https://example.com/file.zip |
Download a file from the web. |
ssh user@server |
Log in to a server over SSH. |
scp file.zip user@server:/tmp/ |
Copy a file to a server. |
rsync -avz ./src/ user@server:/var/www/ |
Sync files efficiently. |
sudo ufw allow 22 |
Open a port in the UFW firewall. |
sudo ufw status verbose |
Show the UFW status in detail. |
| Example command | Purpose |
|---|---|
sudo apt update |
Refresh the package lists from repositories. |
sudo apt upgrade |
Upgrade installed packages. |
sudo apt install nginx |
Install a new package. |
sudo apt remove nginx |
Remove a package. |
sudo apt purge nginx |
Remove a package and its configuration. |
sudo apt autoremove |
Remove packages that are no longer needed. |
sudo apt clean |
Clear the package download cache. |
apt search nginx |
Search for a package in the repositories. |
apt show nginx |
Show details of a package. |
apt list --installed |
List installed packages. |
sudo dpkg -i paket.deb |
Install a .deb file. |
sudo add-apt-repository ppa:ondrej/php |
Add a PPA repository. |
| Example command | Purpose |
|---|---|
whoami |
Show the active user name. |
id |
Show the user's UID, GID, and groups. |
who |
See who is currently logged in. |
w |
Active logins with their activity. |
users |
List logged-in user names. |
groups |
Groups the active user belongs to. |
sudo adduser budi |
Create a new user interactively. |
sudo useradd -m budi |
Create a new user with a home directory. |
sudo usermod -aG sudo budi |
Add a user to a group. |
sudo userdel -r budi |
Delete a user together with their home. |
sudo passwd budi |
Change a user's password. |
last |
Show recent login history. |
| Example command | Purpose |
|---|---|
systemctl status nginx |
Show the status of a service. |
sudo systemctl start nginx |
Start a service. |
sudo systemctl stop nginx |
Stop a service. |
sudo systemctl restart nginx |
Restart a service. |
sudo systemctl reload nginx |
Reload configuration without stopping the service. |
sudo systemctl enable nginx |
Enable a service at boot. |
sudo systemctl disable nginx |
Disable a service at boot. |
systemctl list-units --type=service |
List the services. |
sudo systemctl daemon-reload |
Reload the systemd units. |
journalctl -u nginx |
Show a service's logs. |
journalctl -f |
Follow systemd logs live. |
sudo reboot |
Reboot the system. |
sudo shutdown -h now |
Shut the system down now. |
timedatectl |
Show the system time and timezone. |
| Example command | Purpose |
|---|---|
uname -a |
Show kernel and architecture info. |
hostname |
Show the machine's host name. |
hostnamectl |
Details about the host name and OS. |
uptime |
How long the system has been up and its load average. |
date |
Show the current date and time. |
cal |
Show this month's calendar. |
lscpu |
Show CPU information. |
lsusb |
List attached USB devices. |
lspci |
List attached PCI devices. |
vmstat 1 |
Virtual memory statistics every second. |
watch -n 2 df -h |
Re-run a command every two seconds. |
dmesg |
Show the latest kernel messages. |
dmesg -T |
Kernel messages with human-readable timestamps. |
| Example command | Purpose |
|---|---|
env |
Show the environment variables. |
printenv PATH |
Show the value of a single variable. |
export APP_ENV=production |
Set an environment variable. |
unset APP_ENV |
Remove an environment variable. |
echo $PATH |
Show the contents of the PATH variable. |
alias ll='ls -lah' |
Create an alias for a command. |
unalias ll |
Remove an alias. |
history |
Show the command history. |
source ~/.bashrc |
Reload the shell configuration. |
crontab -e |
Edit the cron schedule. |
crontab -l |
List the active cron schedule. |
tmux new -s kerja |
Open a terminal session that stays alive. |
| Example command | Purpose |
|---|---|
sha256sum file.zip |
Create a SHA-256 checksum. |
md5sum file.zip |
Create an MD5 checksum. |
base64 file.txt |
Turn a file into Base64 text. |
base64 -d file.b64 |
Turn Base64 text back into a file. |
openssl rand -base64 32 |
Generate a random 32-byte key. |
gpg -c file.txt |
Encrypt a file with a passphrase. |
gpg -d file.txt.gpg |
Decrypt a file. |
Besides single commands, the shell offers operators to combine and redirect output. Each example below stands on its own.
Redirect output to a file (overwriting it):
ls -lah > daftar.txt
Append output to the end of a file:
echo "baris baru" >> catatan.txt
Send standard error to a separate file:
php artisan migrate 2> error.log
Discard output so it is not shown:
command > /dev/null 2>&1
Pipe the output of one command into another:
ps aux | grep nginx
Run the second command only if the first succeeds:
sudo apt update && sudo apt upgrade
Run the second command only if the first fails:
ping -c1 server || echo "server tidak merespons"
Insert the result of another command:
echo "Sekarang: $(date)"
Turn a list of input into command arguments:
cat daftar.txt | xargs rm
Feed text in as standard input:
grep "error" <<< "baris berisi error"
Mastering the commands above already covers most daily terminal work: managing files, monitoring the system, configuring networks, and installing packages. Keep this article as a cheat sheet and memorise the handful you use most. If you would rather run them from a menu without memorising the options, many of these commands are available in mdwn — try the browser demo first or follow the installation guide.
mdwn turns dozens of Linux commands into one tidy terminal menu. Here is what every menu does, plus an interactive browser demo you can try safely.
Read article →Inside Alpine Linux: why this 5 MB distro is the top choice for Docker images, what makes it different, and whether it can be a daily driver.
Read article →From a Finnish student’s hobby in 1991 to dominating servers and the cloud — follow Linux’s 35-year journey and the evolution of its distros.
Read article →