๐Ÿง Linux File Command Cheat Sheet (Quick Reference)

๐Ÿง Linux File Command Cheat Sheet (Quick Reference)
Operating System(s)

This Linux file cheat sheet covers the most important commands for managing files and directories in Linux. Use it as a fast reference whether you're a beginner or power user.

๐Ÿ“‚ File & Directory Basics

CommandDescription
lsList files and directories
ls -lDetailed list (permissions, size, date)
ls -aShow hidden files
pwdShow current directory
cd dirChange directory
cd ..Go up one level

๐Ÿ“„ Create & Manage Files

CommandDescription
touch file.txtCreate empty file
cp file1 file2Copy file
mv file1 file2Move or rename file
rm file.txtDelete file
rm -r folderDelete folder recursively
mkdir folderCreate directory

๐Ÿ“– View File Contents

CommandDescription
cat file.txtShow full file
less file.txtScroll through file
head file.txtFirst 10 lines
tail file.txtLast 10 lines
tail -f file.txtLive file updates

๐Ÿ” Search & Find Files

CommandDescription
find / -name file.txtSearch by name
grep "text" file.txtSearch text inside file
locate file.txtFast search (indexed)

๐Ÿ“ฆ File Compression & Archives

CommandDescription
tar -cvf file.tar folder/Create archive
tar -xvf file.tarExtract archive
gzip file.txtCompress file
gunzip file.txt.gzDecompress file

๐Ÿ” Permissions & Ownership

CommandDescription
chmod 755 fileChange permissions
chmod +x script.shMake executable
chown user fileChange owner
chgrp group fileChange group

๐Ÿ”— Links (Shortcuts)

CommandDescription
ln file linkCreate hard link
ln -s file linkCreate symbolic link

๐Ÿ“Š Disk Usage & File Info

CommandDescription
df -hDisk space usage
du -sh folderFolder size
stat file.txtDetailed file info
file file.txtDetect file type

โšก Useful Shortcuts

ShortcutAction
Ctrl + CStop command
Ctrl + ZPause command
TabAuto-complete
โ†‘ / โ†“Command history

๐Ÿš€ Real-World Examples

Copy a folder

 

cp -r myfolder backup/

 

Delete all .log files

 

rm *.log

 

Find large files

 

find / -size +100M

 

โš ๏ธ Common Mistakes

  • โŒ Using rm -rf without checking path
  • โŒ Overwriting files with mv or cp
  • โŒ Forgetting permissions when running scripts

๐Ÿ‘ Quick Summary

  • Use ls, cd, pwd for navigation
  • Use cp, mv, rm for file management
  • Use grep, find for searching
  • Use chmod, chown for permissions

๐ŸŽฏ Final Thoughts

Mastering Linux file commands gives you full control over your system. With just a handful of commands, you can manage files faster than any graphical interface.

Force Cache (Faster Mirror)

Linux Commands

Files

tar ยท pv ยท cat ยท tac ยท chmod ยท grep ยท  diff ยท sed ยท ar ยท man ยท pushd ยท popd ยท fsck ยท testdisk ยท seq ยท fd ยท pandoc ยท cd ยท $PATH ยท awk ยท join ยท jq ยท fold ยท uniq ยท journalctl ยท tail ยท stat ยท ls ยท fstab ยท echo ยท less ยท chgrp ยท chown ยท rev ยท look ยท strings ยท type ยท rename ยท zip ยท unzip ยท mount ยท umount ยท install ยท fdisk ยท mkfs ยท rm ยท rmdir ยท rsync ยท df ยท gpg ยท vi ยท nano ยท mkdir ยท du ยท ln ยท patch ยท convert ยท rclone ยท shred ยท srm ยท scp ยท gzip ยท chattr ยท cut ยท find ยท umask ยท wc ยท tr ยท hash  ยท compgen

Processes

alias ยท screen ยท top ยท nice ยท renice ยท progress ยท strace ยท systemd ยท tmux ยท chsh ยท history ยท at ยท batch ยท free ยท which ยท dmesg ยท chfn ยท usermod ยท ps ยท chroot ยท xargs ยท tty ยท pinky ยท lsof ยท vmstat ยท timeout ยท wall ยท yes ยท kill ยท sleep ยท sudo ยท su ยท time ยท groupadd ยท usermod ยท groups ยท lshw ยท shutdown ยท reboot ยท halt ยท poweroff ยท passwd ยท lscpu ยท crontab ยท date ยท bg ยท fg ยท pidof ยท nohup ยท pmap

Networking

netstat ยท ping ยท traceroute ยท ip ยท ss ยท whois ยท fail2ban ยท bmon ยท dig ยท finger ยท nmap ยท ftp ยท curl ยท wget ยท who ยท whoami ยทยท iptables ยท ssh-keygen ยท ufw ยท arping ยท firewalld