File Management
lsList directory contents
Example:
ls -lacd [directory]Change directory
Example:
cd /var/wwwpwdPrint working directory
Example:
pwdmkdir [name]Create a directory
Example:
mkdir my-projectrm [file]Remove file
Example:
rm file.txtrm -rf [directory]Remove directory recursively
Example:
rm -rf node_modulescp [source] [dest]Copy file or directory
Example:
cp file.txt backup.txtmv [source] [dest]Move or rename file
Example:
mv old.txt new.txtFile Content
cat [file]Display file contents
Example:
cat config.jsongrep [pattern] [file]Search for pattern in file
Example:
grep "error" log.txtPermissions
chmod [permissions] [file]Change file permissions
Example:
chmod 755 script.shchown [user]:[group] [file]Change file owner
Example:
chown www-data:www-data index.htmlSystem
ps auxList running processes
Example:
ps aux | grep nodetopDisplay system processes
Example:
topkill [pid]Kill a process
Example:
kill 1234df -hShow disk usage
Example:
df -hdu -sh [directory]Show directory size
Example:
du -sh /var/logArchive
tar -czf [archive.tar.gz] [files]Create compressed archive
Example:
tar -czf backup.tar.gz /home/userRelated Resources
1 itemsCompare Options
Frequently Asked Questions
How do I use this linux commands cheatsheet?
Simply find the command you need, click the copy button to copy it to your clipboard, and paste it into your terminal or code editor. Each command includes a description and example to help you understand its usage.
Can I download this cheatsheet?
Currently, this cheatsheet is available online. You can bookmark this page for quick access.