Useful commands

  • Get procces id by port
lsof -i tcp:3690

or

netstat -nlp | grep 8080
  • Find the largest 10 files (linux/bash)
find . -type f -print0 | xargs -0 du | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}
  • Find the largest 10 directories
find . -type d -print 0 | xargs -0 du | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}
  • Accept port
sudo iptables -I INPUT -p tcp --dport 5672 -j ACCEPT
  • Get processor type
uname -m
  • Delete all file avant la date défini
find . ! -newermt 2017-09-06 -exec rm -rf {} \;

Find list of extension in a tree

find . -type f perl -ne ‘print $1 if m/.([^.\/]+)$/’ sort -u

Find by extension

find . -type f -name “.mp