Tools
Bash & Linux Command Cheat Sheet
The Linux and Bash commands that cover most day-to-day terminal work, grouped by task.
Put it into practice with the matching tool.
Calculate chmod permissions →Advertisement
Navigating
pwdPrint the current directoryls -lahList files: long, all (incl. hidden), human sizescd /pathChange directorycd -Jump back to the previous directorytreeShow a directory treeFiles & directories
cp src destCopy a file (use -r for directories)mv src destMove or renamerm fileDelete a file (-r for directories, careful)mkdir -p a/b/cCreate nested directoriestouch fileCreate an empty file / update its timestampln -s target linkCreate a symbolic linkViewing & searching
cat filePrint a whole fileless filePage through a file (q to quit)head -n 20 fileFirst 20 lines (tail for the last)tail -f logFollow a log file livegrep -r "text" .Search recursively for textfind . -name "*.js"Find files by name patternwc -l fileCount linesPermissions & ownership
chmod 755 fileSet permissions (owner rwx, others rx)chmod +x script.shMake a file executablechown user:group fileChange owner and groupsudo commandRun a command as superuserProcesses & system
ps aux | grep nodeFind running processestop / htopLive process and resource monitorkill -9 <pid>Force-terminate a processdf -hDisk space used and freedu -sh *Size of each item in this directoryPipes, redirection & archives
cmd > fileWrite output to a file (overwrite)cmd >> fileAppend output to a filecmd1 | cmd2Pipe output of one command into anothercmd 2>&1Redirect errors into standard outputtar -czf out.tar.gz dir/Create a gzipped archivetar -xzf file.tar.gzExtract a gzipped archive