Posts Tagged ‘bashrc’

.bashrc customizations

Posted: October 23, 2009 in Linux
Tags: , , ,

Any system file in Linux that ends with ‘rc‘ ( rc stands for run command ) will have startup instructions for the associated application.
.bashrc, .vimrc, .mailrc, .chsrc etc are few examples.

Here are some useful customizations in .bashrc file. Once .bashrc is edited, to see its effect, it is needed to run the command :

$source ~/.bashrc

1. grep ( global regular expression print )

alias grep='grep -i -n -R --color'

This alias is useful in displaying the grep result with more information.

2. to increase the history file size, add these four lines.

shopt -s histappend
shopt -s cmdhist
export HISTSIZE=100000
export HISTFILESIZE=100000

This will maintain enough information that are required in most cases.

3. cd followed by ls

Let us define a new function cdl

cdl()
{ command cd "$@" && ls; }

4. to find the size of current folder  du -sh

alias sd='du -sh'

5. to find the size of all files inside the current folder du -sh *

alias sall='du -sh *'

6. df -h is useful to find out how much free space is available in various partitions of the hard disk.

Advertisements