cheatsheets / cli

Command line


What’s running on port 3000?
lsof -i :3000

What’s eating my memory?
top -o MEM

How much free disk space do I have?
df -h

How much space does directory some-dir/ occupy?
du -sh some-dir

Create an SSH key for GitHub
ssh-keygen -t rsa -C ""


Log into a a remote machine using a key
ssh user@ip -i path/to/key

Copy stuff over SSH (you have to be on the machine you are copying from, not to)
scp -i path/to/ssh-key path/to/source user@ip:path/to/destination


You’ll need awscli for these.

Deploy a static site to s3
aws s3 sync ./dist s3://my-repo --delete

Invalidate CloudFront cache
aws cloudfront create-invalidation --distribution-id myDistributionId --paths '/*'

Image manipulation

Tools: imagemagick and ffmpeg (brew install ffmpeg).

Create a favicon
magick input.png -resize 32x32 favicon.ico

Extract first frame of a video to image
ffmpeg -i input.mp4 -vframes 1 output.png

Daily life stuff

Check what time it is

Check the weather

Browse the internet