Top Tips from Linux-Fu

I have recently been giving a talk entitled “Linux-Fu for PHP Developers” (slides are here) and although it includes some really basic commands, even some quite experienced people have thanked me for particular bits that they picked up. I’m considering dropping some of the sections from this talk so here are the things people most tell me they learned:

cd –

If you pass a single minus as the argument to cd, you will change back into the directory you just came from. Ideal for those switching-between-two-deep-links situations.

pushd and popd

I didn’t include these in my talk formally but I mentioned them almost every time I gave it (or one of the attendees did!). I don’t actually use these commands, but they are like an extension to “cd -” – you can build up stacks of directories and then jump around between them. They sound pretty handy so do take a look.

ls -lrt

I got a lot of negative comments for including “cd” and “ls” in my talks – but I had quite a few people say that the -t (to sort by time) and the -r (to reserve the sort) switches were new to . I use these together for viewing which files are new in a directory, great for logfiles or upload directories.

Hope these are helpful to someone, let me know if you use these or have others you’d like to share!

3 thoughts on “Top Tips from Linux-Fu

  1. I’ve been using “cd $OLDPWD” for years now, without knowing “cd -” existed. Very easy to get into habits like this, even though there may be something simpler others take for granted. Thanks for the time-saving tip.

  2. I guess that’s the secret sauce of linux. There is something new to learn for everyone, always, no matter how long you’ve been working with it.

    Personal fav. of mine.

    find ./ -name *.torrent -exec rm {} \;

    Because, umm, you know, those files just seem to pile up for some reason. Al those darn linux iso torrents.

  3. Bashir: I often learn something when looking over the shoulder of another developer, the talk was an attempt to scale that experience to a conference audience – glad you picked up something new :)

    Erik: I’m just starting to pick up these favourite commands that I run all the time, I’m blogging most of them though for reference (and so I can’t lose/forget them)

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

This site uses Akismet to reduce spam. Learn how your comment data is processed.