It’s great to be able to harnessing the power of the unix shell, here’s some favourite commands …
uptimeHow long has your system been running for? If you hate the power switch as much as me there’s a perverse enjoyment in this one. Currently on 24 days as I type, good old macbook!
historyList all your recent command history. This is great if you pipe to grep also, can’t remember the exact arguments you typed last time?
$: history | grep some-command
32 some-command
Notice the number next to the output, that’s the number of the entry in your history log. Want to re-run some-command just type !32.
svn diff | mateIt’s really useful to do an SVN diff before you commit but if you just run it in the terminal the output can be hard to read. Textmate (Mac only sorry) has excellent highlighting and folding features for diff files and you can pipe the output from your SVN client straight into it.
pushd, popd, dirsThese three are really useful. Suppose your in one directory and want to jump out and have a root around elsewhere, you can use pushd to jump to a new directory stack, if you want to go back to the previous stack just pushd again. As you might expect popd drops the current stack and puts you back on the previous one whilst dirs lists all the directory stacks you’ve created.
ps -axFirefox locked up and crashed again? Can’t be bothered to wait 15 minutes for eclipse to shut down? You can find out the process id of any running program with the ps command. Again it’s useful to use grep here to search the output, next time you’ve had enough of eclipse try this …
$ ps -ax | grep eclipse
81404 ?? 0:16.92 /Applications/.../MacOS/eclipse
$ kill 81404
Comment
blog comments powered by Disqus