Linux Commands


Linux Commands



Here are the pocket reference commands :


  • To remove SINGLE LINE Comment in a file - sed -i '' -e 's|//||g' <input file>
  • To remove Blank Lines in between Lines - sed -i '' '/^$/d'  <input file> or AWK would do - awk 'NF' <input file>.
  • grep -v "Session:" LoggedinLoadCache_5.log | grep -v "Session"
  • List the processes with name streamlink - ps aux | grep streamf1
  • Kill the process with the id eg. 26959 - kill -9 26959 
  • Kill all streamlink processes in 1 command: - ps aux | grep streamf1 | awk '{print $2}' | xargs kill -9
  • dadoor_netstat_function ()
  • {    netstat -Watnlv | grep LISTEN | awk '{"ps -o comm= -p " $9 | getline procname;colred="\033[01;31m";colclr="\033[0m"; print colred "proto: " colclr $1 colred " | addr.port: " colclr $4 colred " | pid: " colclr $9 colred " | name: " colclr procname; }' | column -t -s "|"
  • } Output > dadoor_netstat_function proto: tcp4 addr.port: 127.0.0.1.9999 pid: 70078 name: /Library





Post a Comment

0 Comments