Month: January 2017

Convert Windows line endings to Linux line endings using vim

Windows uses the CR/LF characters (Carriage Return and Line Feed) to indicate a line-ending. Under Linux this is only one character, LF. You might see some strange characters at line-endings when editing a file in Linux that was saved in Windows.

To convert these line endings under Linux perform the following steps:

  • Edit the file with vim
  • Give the command :set ff=unix
  • Save the file

Solution Source

Leave a Comment

Dump all Apache requests

On an AWS EC2 instance I needed to find the contents of the X-Forwarded-For header of incoming requests, send by CloudFront. The easiest way was to dump all incoming traffic on port 80:

sudo tcpdump -s 0 -X 'tcp dst port 80' -w dump.pcap

I then copied the dump.pcap to my local machine and loaded it into Wireshark to read its contents.

Solution source

Leave a Comment