aaraza
6/28/2017 - 2:48 AM

Useful CLI commands

Useful CLI commands

# Move all subdirectory files into parent folder
find . -mindepth 2 -type f -print -exec mv {} . \;

# Remove files from temp directory older than 12 hrs
find /tmp/* -mmin +720 -exec /bin/rm -rf {} +

# Change default screenshot location on macs
defaults write com.apple.screencapture location <path>

# Rename files in a folder example
for f in *.mkv; do mv "$f" "`echo $f | sed s/'Death Note - '/'Episode '/`"; done

# List of ports that are currently being used
sudo lsof -i -P -n | grep LISTEN