Command line - nimrody/knowledgebase GitHub Wiki

CSV manipulation commands

One liners

  • List of connections using port 8080

    ss -pn '( dport = 8080 or sport = 8080 )'

  • Get list of recently changed files:

    find $1 -type f -exec stat --format '%Y :%y %n' "{}" ; | grep -v cache |sort -nr | cut -d: -f2- | head

  • Perl one liner search and extract

    perl -ne 'if (/(http.*?.m3u8)/) { print "$1\n"; }' *.html |uniq

  • tcpdump - save to pcap file and display data on screen

    tcpdump -n -w - port 8080 |tee dump.pcap |tcpdump -A -r -

  • More tcpdump

  • tcpdump tutorial

  • Common tcpdump options

  • Bash redirection

VIM

  • Tidy HTML (or XML) using tidy app: :!tidy -mi -html -wrap 0 % (will update the file inplace. use -xml for XML file).

  • To reformat json in Vim:

    :%!python -m json.tool
    
  • To highlight lines matching pattern

    :highlight feed ctermbg=darkred :match feed /search-term/

    Where feed is the group name

Installation

  • Installing Rbenv

  • To install the mysql gem using bundler one need to first sudo yum install mysql-devel