Posts Tagged ‘unix’

Fixed Poor Netflix Performance with pfSense

June 3rd, 2016 1 comment

I was having terrible Netflix performance when connecting through my pfSense 2.3 router (running on XenServer 6.5), but Netflix was fine when I bypassed pfSense altogether or when I connected to Netflix through my StrongVPN connection passing through pfSense.

After much research, investigations, and Wiresharking, I made the following three configuration changes that seem to have fixed the problem.
Read more…

Categories: Uncategorized Tags: , , , ,

Searching GZipped Log Files

March 18th, 2014 1 comment

I have a few handy scripts for searching through log files, especially monitoring SSH login attempts. I cannot just grep through log files however, because the log files get “rolled”: compressed, and archived.

rob@kanga:/var/log $ ls -lh system.log*
-rw-r-----@ 1 root  admin   289K Mar 18 17:16 system.log
-rw-r-----  1 root  admin    79K Mar 18 00:00 system.log.0.gz
-rw-r-----  1 root  admin    39K Mar 17 00:02 system.log.1.gz
-rw-r-----  1 root  admin    36K Mar 16 00:02 system.log.2.gz
-rw-r-----  1 root  admin    35K Mar 15 00:02 system.log.3.gz
-rw-r-----  1 root  admin    25K Mar 14 00:01 system.log.4.gz
-rw-r-----  1 root  admin    69K Mar 13 00:01 system.log.5.gz
-rw-r-----  1 root  admin    68K Mar 12 00:01 system.log.6.gz
rob@kanga:/var/log $

Suppose you want to grep through your log files for SSH login activity, you can do it like this:

rob@kanga:/var/log $ { cat /private/var/log/system.log ; gunzip -c /private/var/log/system.*.gz ; } | grep sshd | wc -l
rob@kanga:/var/log $

The magic happens in the curly braces, which concatenates the standard output of all enclosed commands. Be sure to include a semicolon after the last command, right before the closing curly brace.

An even shorter example:

rob@kanga:/var/log $ { echo hello ; echo world ; } | cat -n
     1	hello
     2	world
rob@kanga:/var/log $
Categories: Utility Tags: , , , , , ,

Writing Finder Comments from the Command Line

August 7th, 2011 3 comments

I had some old (we’re talking Apple IIGS era old) files that I wanted to keep around, and I wanted Spotlight to show them if there was a valid hit. Many of the file formats I cannot read anymore, but even a raw dump of the file could at least reveal the information I needed. What I could not find online was a way to write Spotlight-findable data from the command line. My idea was to run the strings command and embed that as a comment. I finally figured it out on my own, and it involves embedding AppleScript in a shell script via osascript. Read more…

Categories: Utility Tags: , , , ,

Spotlight Searching at the Command Line

April 5th, 2011 3 comments

If you know about the mdfind command that lets you perform Mac OS X Spotlight searches at the command line (The Power of mdfind, O’Reilly), then you know it’s a good start but ultimately unsatisfactory. I made up a shell script mdfindi that helps me interactively navigate the results of mdfind when I SSH into my home computer. Of course I keep the script on my Dropbox as mentioned in an earlier post so that it is available to all of my computers.

Read more…

Categories: Utility Tags: , , ,

Bash Profile Sharing and Useful Scripts

March 17th, 2011 2 comments

If you live at the command line as I do, you probably have a number of aliases, functions, and status updates added to your ~/.bash_profile, ~/.bashrc, or similar file. With a little effort you can share the critical components across several computers either automatically (Dropbox or SugarSync) or manually. The key is to abstract away machine-specific references. The following are suggestions for useful additions to your command line lifestyle.

Read more…

Categories: Utility Tags: , , ,

Let Front Row Access Other User’s iTunes Account on the Same Computer

November 17th, 2010 23 comments

I wanted to set up my main iMac in a central location to replace an aging “half basketball” iMac that’s used for playing kid cartoons and music. I would like for this computer to play all the content in my iTunes library, but I do not want my account wide open for (little) people to muck about in.

Fast User Switching to the rescue! Kind of. If I leave iTunes running in my account and switch to the Kids account, their iTunes can see my shared library; that’s a good start. I want Front Row to be able to see that item under “Sources,” but it does not.
Read more…

Categories: Utility Tags: , , ,

Titlecase at the Command Line (and Mac OS X Services)

September 24th, 2010 No comments

Sometimes I want to change a line of text to titlecase Where Every Word Is Uppercase, and I am rarely in a program that offers that feature natively. I am usually at the command line or in a web browser or some such thing. To that end I put together some command line scripts and an Automator Service so that I could have an appropriate filter.
Read more…

Categories: Utility Tags: , ,

NCSA Mosaic on the Mac

September 14th, 2010 No comments

A nostalgia article on PC World, Finding Stuff Online: 20 Years of Innovative Search Engines, reminded me that I should share my running version of NCSA Mosaic v2.7 with others. I don’t know where I got it, but it might have been from the Floodgap guys.
Read more…

Categories: Utility Tags: , , , ,

The Importance of the Editor “ed”

June 5th, 2009 1 comment

You know you’re having a rough day when you start editing files with “ed,” a somewhat painful-to-use editor that at least never lets you down. It doesn’t pick you up very far either, but hey, having low expectations is the key to happiness. I keep an ed quick reference sheet the size of a matchbox taped to my laptop for these kinds of days. Here’s the Wikipedia article. Read more…

Categories: Utility Tags: , ,