Top Tips from Linux-Fu
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!
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.
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.
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)