Setting Alias :
Aliases are abbreviations for commands or sets of commands. Example :
alias h= 'history' now Entering h in shell will execute the history command.
alias ls ='ls -l'
you can set these in .bashrc so that every time you login these aliases will be set
to delete the previous alias definitions issue the commands:
Defining Functions :
Functions can also be used to ensure that graphical commands always open in the background:
this can be defined in .bashrc
command gimp "$@" &
Now every time you do gimp it will load it in backgroun automatically.
Searching history :
this will print history of last n commands
for searching it CTRL + R can be user
Directory Name Typos
When changing directory small typos can be ignored by Bash
Enable this in
shopt -s cdspell
Bash will cope with each component of the typed path having one missing character, one extra character, or a pair of characters transposed:
$ cd /vr/lgo/apaache
Some directories are changed to more frequently than others.
Can avoid typing their full paths if their parents are in
$CDPATHwrite this in .bashrc
now if dir2 is in projects directory then you can do
It will go to dir2 due to CDPATH
env Lists all environment variable
Commands to be executed on opening shell should be written in .bashrc
Commands to be executed on logout should be written in .bash_logout
For changing the way prompt looks you can set variable PS1
Enhancing the System Prompt change PS1 variable
More About Shell
CTRL + L will clear the screen
CTRL + T will interchange last two letter of a command