A place for Arch users' .bashrc file tips and tricks. .bashrc is a configuration file that contains commands to be executed whenever an interactive shell is started.
To colourise the bash prompt: Comment out the default PS1:
#PS1='[\u@\h \W]\$ '
The following PS1 is useful for a root bash prompt, with red designation and green console text:
PS1='\[\e[0;31m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[0;31m\]\$ \[\e[m\]\[\e[0;32m\] '
See also this wiki page
Default command usage
To make rm prompt for removals
alias rm='rm -i'
to make cp and mv prompt for overwrite
alias cp='cp -i' alias mv='mv -i'
To make spelling mistakes not matter
alias unmount='umount' alias pakman='pacman'
Seen in forums to force someone to learn vim
Useful environment variables
Set a default text editor
Add a scripts directory to your path statement
You can add a 'scripts' directory (or any other for that matter) to your path simply by adding the following line
Modify as needed. Now when you open a new shell window, you can simply type the name of your scripts.
HTTP / FTP Proxy
You can export your HTTP and FTP proxy settings from .bashrc by adding the following:
export http_proxy="http://172.16.1.6:3128" export ftp_proxy="ftp://172.16.1.6:3128"
It is use full to have auto complete feature(pressing "tab" key 2 times on keyboard) after you type some command like "sudo".
To do this add line in this format to your .bashrc file:
complete -cf your_command
complete -cf sudo
With this line you can use auto complete feature after command "sudo"
complete -cf man
This will allow you to use auto complete after "man" so you don't have to remember exact name of man page you want to read