Bash Tips
1. Directory shortcuts
You can assign shortcuts to the directories u frequently use.
just add the following in your .bashrc
function l
{
command cd /opt/development/linux-2.6.18
}
export l
now l is a new shortcut to the linux-2.6.18 directory , just type l and enter to go there.
add more functions like this to create shortcuts to dirs u frequently use.
2. New Command names
most of the time we use commands like
ps ax | grep xyz or cat abc | grep xyz
now instead for typing this every time u can give them new names
function pgrep
{
command ps ax | grep "$@"
}
export pgrep
and
function catg
{
command cat "$1" | grep "$2"
}
export catg
"$@" inserts the arguments passed .
"$1" , "$2" are ur 1st and 2nd arguments
now u can use "pgrep xyz" instead of typing "grep ax | grep xyz"
here are some of the commands that I use
sudo apt-get install --> ainstall
sudo apt-get remove --> aremove
.
.
all apt-get commands
make menucnfig --> mmc
make distclean --> mdc
.
.
all frequently used make commands
grep -rin "$@" * --> cgrep
find . -name "$@" --> nfind
and all frequently edited files and frequently used ssh and scp commands.
(here is a link on howto use ssh and scp without passwords)
3. Usefull shortcuts
ctrl + l --> Clear Screen
ctrl + w --> Delete last word
ctrl + c --> Cancel the command you are typing
alt + u --> Make the word uppercase
ctrl + r --> Search History
ctrl + d --> Exit the Shell








