Terminal.app – Command Line Kung-Fu on MacOSX
Since, I’ve been at home coding most of the day away, I’ve been bring across some old tricks I learnt while I was in GNU/Linux land during my university days to increase my daily productivity.
Tip #1: Terminal.app 101
Getting to know Terminal.app not only increases your karma points a hundred fold, but can provide some marked gains in productivity. First things first, locate the application and run: /Applications/Utilities/Terminal.app.
Once you’ve got the Terminal running, we’re going to pimp out our colour-scheme to give our Terminal that awesome Matrix uber-hacker look!
With Terminal.app open navigate to the settings window, select Terminal > Preferences > Settings. Here you can pick from a number of built-in themes – so pick a style that fits you (I’ve always found the ‘Pro’ theme the easiest to read and I love the retro green-screen look).
Next, you want to make sure that you’ve enabled “Antialias text” to help make the font legible under all conditions. If you prefer not to enable this feature, you may want to uncheck the “Use bright colors for bold text” option, since you may find some text difficult to read.
Now if the plain black terminal background doesn’t cut it for you, try setting the background’s transparency in the Window tab to 90% (this allows you to keep reading the Terminal while the background windows are not terribly annoying).
NB: If you SSH frequently into boxes running GNU/Linux or Solaris via the Terminal, you’ll want to ensure that the DELETE key sends the CTRL+H keyboard sequence. To do this, simply check the option in Terminal > Preferences > Settings > Advanced > “Delete sends CTRL+H”. While you are in this tab, if you don’t like the Terminal beeping at your mistakes, simply uncheck the “Audible Bell” option – I recommend leaving the “Visible Bell” option enabled so that you know when you’ve made a mistake.
If you like your Terminal.app to be a certain fixed size every time its opened instead of the default size – create a window group. To do this, simply open up any number of windows and terminal tabs (just like in Safari!) and select Window > “Save Windows as Group…” – give the group a name and ensure you’ve ticked the box “Use group when Terminal starts”.
Tip #2: Nice directory listings
One of the most frequently performed tasks in any shell is to list all files within a directory – the problem is that the ls command’s output is not very pretty at first sight. We’re going to fix this…
In a shell enter the following command:
pico ~/.bash_profile – This creates a new file in your home directory which will store our shell’s extra properties.
Now in the editor window, enter the following strings:
export LSCOLORS=Exfxcxdxahegedabagacad export CLICOLOR=1
What we’ve done above, is enabled colour highlighting for the ls shell command. If you don’t like my colour scheme feel free to explore the various colour combinations by viewing the appropriate man page (i.e. man ls).
Tip #3: Alias this!
The UNIX alias command is invaluable in creating quick shortcuts for frequently used commands like ls. I’m lazy and prefer to type a shortcut to list all the files in my current directory, rather than having to type: ls -lhF – so to make my life easier, I’m going to use the alias shortcut to assign a shorter keystroke for the same directory listing command.
In the same ~/.bash_profile file that we edited previously, add the following line:
alias ll='ls -lhF'
This will give you a nice coloured listing of the files, folders and applications in your current working directory. Feel free to experiment and if you have any trouble – don’t hesitate to leave me a comment


[...] Terminal.app – Command Line Kung-Fu on MacOSX [...]
How to Get Help in Linux
December 17, 2008 at 11:39 pm