Book Image

Penetration Testing with the Bash shell

By : Keith Harald Esrick Makan
Book Image

Penetration Testing with the Bash shell

By: Keith Harald Esrick Makan

Overview of this book

Table of Contents (13 chapters)

Aliases


Aliases are a way of effectively assigning a name to a given collection of commands or a single command line. The .bashrc file that comes with every standard issue bash shell includes a few useful ones by default. A few of them are as follows:

# 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 --color=auto'
    #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

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'

What these do is allow you to use one—usually simpler—command to invoke a number of complex commands. So, with respect to the previous code, you can use grep to invoke grep –-color=auto, which enables text output highlighting or color printing.

The general purpose or aim of aliases is to make...