add common commands as aliases

Got this idea from Riinu’s scripting diary. You can add/modify common commands as aliases in your .bashrc file if you are getting tired of typing them all the time

  • open the file with

            vi /path/to/.bashrc #often in ~/.bashrc
            
  • There should be a section within the file similar to this:

            # enable color support of ls and also add handy aliases
            if [ -x /usr/bin/dircolors ]; then
                test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
                alias ls='ls -aoh --color=auto'
                alias qstat='qstat -u shearn'
                #alias dir='dir --color=auto'
                #alias vdir='vdir --color=auto'
    
                alias grep='grep --color=auto'
                alias fgrep='fgrep --color=auto'
                alias egrep='egrep --color=auto'
            fi
            

    Here I have added aliases for for qstat -u shearn (gives qstat user information after only typing qstat) and ls -aoh, where -a lists hidden files, -o is long format without group info and -h gives human readable file size information (eg gb instead of bytes).

  • Something else I usually do is to colour the prompt. To do this, remove the hashtag # from the following line

            #force_color_prompt=yes
            
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s