Command aliases and the .bashrc file.
Customizing the shell.
For connecting to your Westhost server, you can use SSH which will provide you with a login shell over a secure connection. Westhost have a good introduction to the SSH program and in this article I’ll look at some ways to customize that login shell.
If you work in Linux, then SSH is probably already installed; for Windows, Westhost suggest a program called PuTTY. If you are on a Mac, there is a program called MacSSH which works well.
Setting up the working environment.
When you log on to a *nix system, there are a bunch of files that are read in order to customise the resultant shell. The two we are interested in are the ‘.profile’ and the ‘.bashrc’ files. Normally (that is, on a normally installed Linux/Unix system) there are four files, the system wide versions of the above (usually ‘/etc/profile’ and ‘/etc/bash.bashrc’ or similar) and the individual user files (at ‘~/.profile’ and ‘~/.bashrc’ ).
On a Westhost system (maybe because it is a Virtual Server system) these two files appear in the root of the system (at ‘/’) and in fact the ‘/.profile’ is just a link to the ‘/.bashrc’ file. So, for customisation of the shell, we have only one file to deal with.
Some people have reported that their version of .bashrc is owned by root and they cannot make changes to it. If this is the case, you need to make a copy of it owned by you, to do this:
$ cd /
$ mv .bashrc .bashrc.old
$ cp .bashrc.old .bashrc
What you decide to change is of course up to you, this is after all, to be used for setting up the shell for your own convenience. Make a backup of the file before changing it! These are some of the things that I like to change:
First I prefer to use ‘vi’ as an editor, so the EDITOR and VISUAL entries get changed to:
export EDITOR="vi" export VISUAL="vi"
(‘vi’ is in effect ‘vim’, which is a better, improved version of ‘vi’.)
Another line in the exports reads something like this:
export PS1="[\u][\w]$"
This sets how the command prompt looks. There are two things that I normally change here. First, I like to know what the local time is, so I put the time in the prompt:
export PS1="[\t \u][\w]$"
Secondly, I put the current working directory on the line above so that if it gets long, the working end of the prompt doesn’t get to close to the edge of the screen. I also color it blue. So the final prompt line looks like this:
export PS1="[\[\033[1;34m\w\[\033[0m]\n[\t \u]$ "
There are lots of useful (and not so useful) things that you can do with the prompt, this is just what works for me.
A good source of “Bash Prompt” ideas is at the Bash-Prompt-HOWTO
After the exports, you’ll see a bunch of aliases, this is where things get to be fun, an alias is just a short cut for a command, we can modify what is there, and add some of our own. Take a look at what is there first, you’ll see that there is already many aliases, some of which provide a modification of existing commands (i.e. ‘rm’ is mapped to ‘rm -i’ to query each file deletion).
One thing I like to have is colored directory listings, so here are some changes to enable that:
alias dir='ls -al --color=tty' alias ll='ls -l --color=tty' alias la='ls -al --color=tty'
Another one is to list the size of directories in descending order:
alias ducks='du -cks * | sort -rn | head -11'
(You may need to install ‘sort’ yourself, as it was not part of the default installation on early Westhost2 sites).
Messing around with aliases is relatively harmless, but make a back up of your .bashrc file, just in case!
At the end of the .bashrc file is a command to be run, ‘cd /home/${USER}’, which as you can guess changes directory into the user’s home directory. If you wanted to run other commands they can be added here. For example, to check disk quotas on logging in, put this at the end of the file:
quota
For more inspiration on what you can do with .bashrc to make a real productive environment as soon as you logon, check out: www.dotfiles.com or, for that special prompt: Bash Prompts

