Find old bash commands in Linux

Use a wicked one-liner last week, but forget what it was? Search your bash history with grep! If you remember part of the command, you may be able to dig it up.

I was messing around with php-cs-fixer last week, and could not remember what commands I tried out. Searching with

history | grep fixer

found me:

 1333  php-cs-fixer
 1337  php-cs-fixer fix src --dry
 1338  php-cs-fixer fix --dry-run src
 1339  php-cs-fixer fix --dry-run --level all  src
 1340  php-cs-fixer fix --dry-run --level PSR2  src
 1341  php-cs-fixer fix --dry-run --level psr2  src
 1342  php-cs-fixer fix --dry-run --level=psr2  src
 1343  php-cs-fixer fix --dry-run --level=all  src
 1344  php-cs-fixer fix --dry-run src
 1345  php-cs-fixer fix src
 1346  php-cs-fixer fix src | grep sdb
 1347  php-cs-fixer fix src
 1348  sudo php-fixer self-update
 1349  sudo php-cs-fixer self-update
 1350  php-cs-fixer fix src
 1352  php-cs-fixer fix src
 1356  php-cs-fixer fix src
 1357  php-cs-fixer fix src --level=PSR2
 1358  php-cs-fixer fix src --level=psr2
 1424  php-cs-fixer

Splitting PHP class files for PSR-0 compliance

Have a ton of classes in one file that need to be split up? Check out Matthew Turland’s class splitter script.

Put it in a folder somewhere in your computer, open up a terminal in that location, and then use it like this:

php php-class-splitter.php /path/to/file/with/lotsofclasses.php /path/to/new/class/directory

It is likely that you will end up putting your new split classes in the same location as the original file. If you are going for PSR0 compliance, you will need to add a namespace to each class after.

List modified files with SVN in Linux

When the command svn status returns too much information, filter it with grep. This line finds only modified files and leaves out deleted, missing, and unversioned files.

svn status | grep ^M

ERROR: Directory ‘/some/path’ exists but failed copying to ‘/some/other/path’

An error like this prevented my Jenkins build from completing. It was not a permissions issue. Jenkins was not configured with a master and slave.

My ‘/some/path’ source folder was empty.

In this case, PHPDox was failing silently and not outputting files. Another step in the build tried to move those files, but they didn’t exist so the build failed here. Fixing the malfunctioning build step (PHPDox in my case) resolved the issue and build 100% succeeded on the next try.

PEAR connection problems

Having trouble connecting to PEAR channels like,, or I frequently see this error:

Channel "" is not responding over http://, failed with message: Connection to '' failed: php_network_getaddresses: getaddrinfo failed: Name or service not known

Your ISP may be the problem. Mine (Rogers Cable in Canada) certainly was. To get around this issue, choose a HTTP proxy (IP and port number) from and set it as PEAR’s proxy with this command:

sudo pear config-set http_proxy {proxy ip here}:{proxy port here}

You can turn the proxy off with this command:

sudo pear config-set http_proxy ""

Potentially related issues on GitHub:

400 Bad Request error with C# Google Analytics Helper and Unity

If you find “400 Bad Request” errors in the Unity console while testing out the C# Google Analytics Helper within the Unity IDE, try removing spaces from the “page” parameter passed to the LogEvent and LogPage methods. This may help and get tracking requests flowing through to GA.