Linux Tips

You are currently browsing the archive for the Linux Tips category.

It came up in discussion with Terry Smith recently, just how much of a revelation bash’s tab to auto complete feature is for someone who hasn’t discovered it yet.

Tab once to have bash auto complete a string on the CLI which has only one possible match in your current path. If nothing happens, tab twice to see possible matches then continue typing to narrow the focus to one possible match, then tab again to auto complete.

It’s not worth going into any more detail, but if you don’t already know what I’m talking about, next time you’ve got a linux terminal window open, start hitting tab.

Enjoy.

Tags: , , , , ,

This one’s really basic, but just because you’re an ace php developer doesn’t necessarily mean you’ve had a chance to discover all the ins and outs of bash and the linux command line. One of the guys in the office recently asked me how to make a change to multiple files in his code base with a single line command. Find and sed are your friends here. Since I’m a huge fun of doing as many things as possible with one liners, here’s the gist of what we did.

find . -name '*.php' -exec sed -i -e"s#search#replace#g" {} \;

Find the files you want, run sed on each one of them, edit inline with the included expression, done.

Big thing to note is sed using ‘#’ for a seperator and not ‘/’ . I believe the man page still talks about using a forward slash, but ‘#’ works.

The results from your find command are run through the {} so don’t forget that, and a find -exec must be terminated with a \;

Enjoy.

Tags: , , ,

As part of my on going effort to do anything at all with this blog, I’ve decided to start posting any little linux tidbits that spin out of the day to day here at b5media. This new category is where I’ll slap up anything that folks new to linux, or looking for the odd time saver here or there might appreciate.

Tags: , ,

Get Adobe Flash playerPlugin by wpburn.com wordpress themes