Skip to content

Instantly share code, notes, and snippets.

@ddtxra
Last active April 23, 2019 23:53
Show Gist options
  • Save ddtxra/ca99943032025cdb4506 to your computer and use it in GitHub Desktop.
Save ddtxra/ca99943032025cdb4506 to your computer and use it in GitHub Desktop.
Unix tricks

####Search for files being modified in the last 24hours

find . -mtime -1 -ls | grep .log | sort | more

####Search for content in a specifiy file extension

find com.genebio.nextprot.plugin.entry -name '*.groovy' | xargs grep -i "Missing"

####Sort directory sizes

du -h --max-depth=1 | sort -hr

####To paste in a file

cat > filname | paste | crtl + D

SSH tunneling then you can access the targethost by doing localhost:LOCALPORT

ssh user@host -f -L LOCALPORT:targethost:HOSTPORT -N

####Sniff HTTP packages

sudo tcpdump -A -s0 -ien0 port 80

####Find out which process is listening upon a port

netstat -tulpn | grep :9090

Copy public key to a machine in ssh

cat ~/.ssh/id_rsa.pub | ssh username@host "cat >> ~/.ssh/authorized_keys"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment