Charlie Page
Search
K

Command Line (Linux)

Find/Replace

Find and replace all instances of a phrase with another one

sudo find /folder/path -type f -exec sed -i -e 's/originalword/newword/g' {} \;

Delete Folder with many files

cd /path/to/folder && perl -e 'for(<*>){((stat)[9]<(unlink))}'

Largest folders listed out

du -a /path/to/folder | sort -n -r | head -n 10

Rsync

SCP
scp file_to_transfer.txt [email protected]:/directory_to_drop_file/location/
For AWS pem file:
scp -i ~/path/to/key.pem file_to_transfer.txt [email protected]:/directory_to_drop_file/location/

Curl

Get redirect URL

If I want to see where a URL redirects to, run this command:
curl -I -Ls -o /dev/null -w %{url_effective} https://www.google.com