Making BASH simpler – dir and tree

Ubuntu by default has an alias to point to ls.

I find it much better to use a customized tree command instead.

Contents of file ltree:

#!/bin/bash
argu=$*
#ls --color=always $argu | less -R
tree -C $argu | less -R[/code]

I add the following to ~/.bashrc

alias dir='ltree'[/code]

Now on executing dir, I get a beautiful colored hierarchy of directories and files.

Other useful aliases are:
l='ls -l'
la='ls -la' #Included by default in Ubuntu


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.