Thomas Zhang

Commands

Find and run previous command:

history | grep "keyword"
!1234 


Find and kill process on given port:

lsof -i :8000
kill -9 [PID]


View folder structure:

brew install tree
tree -d


Attach timestamps to program execution:

npm install -g gnomon
[ANY COMMAND] | gnomon


Show hex or binary contents of file:

xxd [FILENAME]
xxd -b [FILENAME]


Using ImageMagick to perform image operations:

# Install
brew install imagemagick
# Convert .png to .jpg
magick convert input.png output.jpg


Download YouTube audio:

# Install
brew install youtube-dl
# Extract audio
youtube-dl --extract-audio --audio-format mp3 [URL]


Maintenance:

# Update homebrew
brew update
# Update npm packages
npm update