A few handy Linux commands

Posted by

Here are a few handy commands:

  • Grab the first 200 characters of each line of a log file:
    •  cat access.log |  cut -c 1-200
  • Limit Apache to 40 connections to any IP address:
    • iptables -I INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 40 -j REJECT --reject-with tcp-reset
  • Trace a process to see what files it uses:
    • strace -pPID -e trace=file

That’s it for now!

GoSaBe Blog - Mar 15, 2015 | Linux