Loading...
Loading...
The Unix commands every engineer should know cold with what each one is best for and gotchas to avoid.
Navigate and manipulate the filesystem.
ls -lahList files with sizes (human readable) and hidden files.cd -Switch to previous directory.pwdShow current directory.mkdir -p a/b/cCreate nested directories.cp -r src dstRecursively copy a directory.mv old newMove or rename.rm -rf pathDANGEROUS: recursively delete (no recovery).ln -s target linkCreate symbolic link.chmod +x script.shMake a file executable.chown user:group fileChange ownership.Find things, in files and in directories.
find . -name '*.ts'Find files by glob recursively.find . -type f -size +10MFind files larger than 10MB.grep -rn 'TODO' src/Recursively search for a string with line numbers.rg 'pattern' --type tsripgrep: faster grep with smarter defaults.fzfFuzzy finder. Pipe anything in, search interactively.Read, slice, and transform.
cat file.txtPrint whole file.less file.txtPage through a file (q to quit).head -n 20 fileFirst 20 lines.tail -f /var/log/app.logFollow a log in real time.wc -l fileCount lines.sort | uniq -c | sort -rnTop duplicates pipeline.sed 's/foo/bar/g' fileReplace foo with bar.awk '{print $2}' filePrint 2nd column.cut -d, -f1,3 file.csvCut columns by delimiter.tr -d '\r' < in > outStrip carriage returns.See what's running, manage it.
ps aux | grep nodeFind processes by name.topLive process view.htopBetter top. Install it.kill -9 <pid>Force kill a process.lsof -i :3000What's using port 3000?nohup ./run.sh &Run command detached from terminal.Talk to the network.
curl -i https://...HTTP request, show headers.curl -X POST -d '{}' -H 'content-type: application/json' urlPOST JSON.wget urlDownload a file.ping hostReachability + latency.dig +short example.comDNS lookup.ss -tulpnSockets/ports listening.What's full, what's running.
df -hDisk usage by mount.du -sh *Disk usage per top-level item.free -hMemory usage.uname -aKernel and OS info.uptimeHow long the box has been up + load.Compose commands.
cmd1 | cmd2Pipe stdout of cmd1 into stdin of cmd2.cmd > fileRedirect stdout to a file (overwrite).cmd >> fileAppend stdout to a file.cmd 2>&1Merge stderr into stdout.cmd1 && cmd2Run cmd2 only if cmd1 succeeds.cmd1 || cmd2Run cmd2 only if cmd1 fails.We turn AI cheatsheets into production code. Tell us what you're building.