Peter Pilgrim is an Oracle Java Champion, Software developer, designer and architect for the Java Platform, Agile SCRUM practitioner. Peter is a DZone MVB and is not an employee of DZone and has posted 35 posts at DZone. You can read more from them at their website. View Full User Profile

Favourite Linux and Unix Bash Aliases

07.07.2012
| 3105 views |
  • submit to reddit

I first got involved with commercial UNIX in the early 1990s. It was fascinating experience on Sun Microsystems SunOS 4.1.3, if memory serves. Even before that professional development, I learnt a lot about UNIX and C at university in my fourth year of the degree course. Yet it was my first work experience at a small start up in joint-venture start-up in Southern Germany that got me hooked into UNIX and its open philosophy. It was there at the JV, I learnt about GNU Emacs, the Free Software Foundation, and spent endless hours programming in C, and building, compiling and installing the GNU Compiler myself, GCC and G++. Fun times were had with OSF Motif and X Windows Toolkit development, which I suppose were one of the long ancestors of modern JavaFX graphical user interface engineering. In those heady days of native C programming, little did I know at the time that somebody was writing a byte-code virtual machine with a garbage collector, and another group of clever people were developing a portable, network-enabled, multiple thread enabled, and security conscience programming language close to the C language. I do so ever digress.

I developed the following bundle of Bash Aliases over a couple of decades now. They came from other developers, administrators and tips from popular UNIX / C books and the Internet. Some of these were inspired by situations that I faced on various systems.

Here is a smaller subsection of bash login script:

set -o emacs
# Do not exit on EOF. To exit the shell type `exit'
set -o ignoreeof
# Do not allow output redirection (>) to overwrite an existing file
set -o noclobber
# set the core limit
ulimit -c 10240
 
set history=100
set savehist=50
 
## export LDFLAGS='-lpthread'
## Slackware: export LS_OPTIONS='--8bit --color=tty -F -b -T 0'
## export LS_OPTIONS='--color=tty -F -b --author'
export LS_OPTIONS='--color=tty -F'
 
# Aliases
alias ls="/bin/ls $LS_OPTIONS"
alias ll='ls -l'
alias lsd='ls -ld'
alias la='ls -a'
alias lf='ls -F'
alias lr='ls -alFRt'
alias lx='ls -xF'
alias llar='ls -laFR'
alias lt='ls -lartF'
alias lrt='ls -lrt'
 
alias home='cd ${HOME}'
alias up='cd ..'
alias pe='printenv'
alias senv='env | sort'
alias pu='pushd'
alias po='popd'
alias pud='pushd .'
alias rot='pushd +1'
alias jobs='jobs -l'
alias mroe=more
alias lses=less
alias lsse=less
alias l=ls
alias f=file
alias c=cat
alias m=more
alias j=jobs
alias k=kill
alias d=dirs
alias h=history
alias his=history
alias hm='history | less'
alias sy3='sync; sync; sync; echo "sync 3 times ..."'
alias del='rm -i'
alias bye=exit
alias ciao=exit
 
alias vibashpro='vi ~/.bash_profile'
alias rebashpro='. ~/.bash_profile'
 
PS1="`whoami`@`hostname` [\$HISTCMD] > "
export PS1

These are part of my developer toolbox.

 

Published at DZone with permission of Peter Pilgrim, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

darryl west replied on Mon, 2012/07/09 - 10:16pm

thanks.  it's always helpful to see another user's collection of aliases. 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.