Thursday, December 3, 2009

How to read binary files

To read binary .gz files use the "zless" command.
Example:
$ sudo zless /var/log/mail/info.1.gz | grep -i someone@email.com

Tuesday, October 6, 2009

show apps that are using an Internet connection

Thanks to commandlinefu (http://www.commandlinefu.com/commands/view/3543/show-apps-that-use-internet-connection-at-the-moment.)

To show a list of applications using an Internet connection, use the following commands:

$ lsof -P -i -N | cut -f l -d " " | uniq | tail -n =2 (only shows name of app)
or
$ lsof -P -i -n (shows more info, cleaner look imo)
or
$ ss -p (same result, less clean)
for one line per process:
$ ss -p | cat
for established sockets only:
$ ss -p | grep STA
for just process names:
$ ss -p | cut -f2 -sd\"
or
$ss -p | grep STA | cut -f2 -d\"

Monday, May 18, 2009

How to filter messages by Subject in Postfix

In Postfix in the main.cf file there is an entry for “header_checks = regexp:/etc/postfix/header_checks”

Under /etc/postfix/ edit the header_checks file
Here is an example of a header_checkes file with a filter:
##############################################
/^Subject:.*canceled: local event error/ DISCARD
/^Subject:/ WARN
##############################################
The line /^Subject:.*canceled: local event error/ DISCARD - will deleted without notice to the sender or sending server and log the action in the log file.

The line /^Subject:/ WARN will write the Subject of each message to the log file. This is handy when trying to find a specific message.

Sunday, May 17, 2009

Wine Notes / list of wines I like.

This will be an open ended entry. My hope is to keep my notes and a list of wines I really enjoyed. I have tried some other sites, but I think I would like a "1 stop shop" for all my notes, tech or otherwise. Only time will tell if this will work.

On 5/17/09
Opened a Cooper Hawk Cabernet Tannet. Was told it was a bold, heavy wine. My description is very smooth and easy to drink. I will def. buy this wine again. I was thinking about canceling my subscription, but the last 3 wines I have had, completely changed my mind. I will keep it up for a while longer and re-evaluate...

Other Cooper Hawk wine I like is Chardonnay Viognier. This was crisp and smooth. A perfect balance between sweet and dry for me. I would love this wine on a warm spring/summer day. I would def. buy this wine again.

I got some cheese from the NL farmers market and it pairs perfectly with the cabernet tannat. I will have to get the name at the next farmers market.

On 6/24/09
Its currently 95 degrees outside and I needed to cool off, so I opened a bottle of wine that has been sitting in my fridge for about 2 month. Its a Coopers Hawk Chenin Blanc. First thoughts as I poured it into a glass, super light, very clear, almost as clear as water. First thoughts on taste, very easy to drink. Might be too cold to get a good judgement. A bit dry on the back end. Short finish. Waited about 15 min and let it warm up a bit and aired it out. Not much changed on the taste. Still very good. I was planning on having some cheese and crackers with it, but now I wish I had a fresh fruit as it feels like this would be a good combination. Not sure I would buy again, only because there are other whites that I like better, but I would like a glass of this before or after a nice dinner at Coopers Hawk.

Wednesday, April 8, 2009

Updating time in Ubuntu

To manually update the time in ubuntu run the following command:
#sudo ntpdate ntp.ubuntu.com

This will update the time from the Ubuntu servers

Postfix enable Subject for logging

To enable logging of the "Subject:" information feature in Postfix, you need to modify the "header_checks" file in the main.cf file.

To create a file use this:
"regexp:/etc/postfix/header_checks".

main.cf entry = "header_checks = regexp:/etc/postfix/header_checks"

Once that file is created, you need to modify the file by adding:
"/^Subject:/ WARN"

This will add the Subject text to the info or mail.info log file. You can then grep based on the subject text.