Commands

Copy-paste command-line recipes with the anatomy that matters: the command, what each flag does, and the gotcha that bites — ffmpeg, git, curl, tar and more.

Commandffmpeg
Convert a video to GIF
ffmpeg -i input.mp4 -vf "fps=10,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" output.gif
Commandffmpeg
Extract audio from a video
ffmpeg -i input.mp4 -vn -c:a copy output.m4a
Commandffmpeg
Trim a clip without re-encoding
ffmpeg -ss 00:00:30 -i input.mp4 -t 00:00:15 -c copy output.mp4
Commandffmpeg
Shrink a video's file size
ffmpeg -i input.mp4 -c:v libx264 -crf 28 -preset slow -c:a aac -b:a 128k output.mp4
Commandffmpeg
Resize/scale a video
ffmpeg -i input.mp4 -vf "scale=1280:-2" output.mp4
Commandgit
Undo the last commit, keep changes
git reset --soft HEAD~1
Commandgit
Discard all uncommitted changes
git reset --hard && git clean -fd
Commandgit
Delete a local and remote branch
git branch -d feature-branch && git push origin --delete feature-branch
Commandgit
Change the last commit message
git commit --amend -m "New message"
Commandgit
Stash and restore changes
git stash push -u -m "wip"
Commandcurl
POST JSON to an API
curl -X POST https://api.example.com/items -H "Content-Type: application/json" -d '{"name":"widget"}'
Commandcurl
Download a file
curl -L -o output.zip https://example.com/file.zip
Commandcurl
Follow redirects and show headers
curl -IL https://example.com
Commandtar
Extract a .tar.gz archive
tar -xzvf archive.tar.gz
Commandtar
Create a compressed archive
tar -czvf archive.tar.gz folder/
Commandfind
Find files by name
find . -iname "*.log"
Commandfind
Find the largest files
find . -type f -size +100M
Commandgrep
Search text in files recursively
grep -rn "TODO" .
Commandkill
Kill the process using a port
kill -9 $(lsof -t -i:3000)
Commandchmod
Make a script executable
chmod +x deploy.sh