Brevis esse laboro, Obscurus fio -- I strive to be brief, and I become obscure.     CEE UCL HelpDesk Homepage

Department of Civil and Environmental Engineering
Frank Batten College of Engineering and Technology
Old Dominion University
Norfolk, Virginia 23529-0241, USA
Tel) (757) 683-3753
Fax) (757) 683-5354


	
Return to CEE UCL HelpDesk Homepage
CEE UCL HelpDesk Access Counter
 
Collection of Useful Aliases


  
Here's just few of usefaul aliases you can put in your .*rc file(s). (where * is your shell such as csh, tcsh, bash and zsh) Alias is a pseudonym or shorthand for a command or series of commands, i.e., a convenient macro for frequently used command or a series of commands. Thus you can create as many aliases as you want, both from the simplest to the nuttest. The main key is that if you hate to type the line of command(s), you should consider either making it into an alias or writing a shell script.

An alias definition affects the current shell execution environment and the execution environments of the subshells of the current shell. The alias definition will not affect the parent process of the current shell nor any utility environment invoked by the shell.

Syntax for defining alias will differ depending on which shell you're using. See specific section applicable for your shell. However, it is very easy to convert one to another, and folowing is the general syntax;

  • C shell category (tcsh and csh)

    $ alias alias_name 'command'

  • Bourne shell category (bash, zsh and sh)

    $ alias alias_name='command'

Alias (all in one line) Description
alias census 'who | wc -l' Quick way to determine how many users are currently working on the system
alias day date+"%A" Display day of the week it is
alias tyme date +"%r" Displays the time in AM and PM format
alias td '( echo; date +"%b %d %r"; cal| tail -7 )' Additoinal formatting for calendar display. (or use 'gcal' command)
alias cd 'cd \!*; set prompt="['`hostname`']<$cwd>"' Set command line displays the current path at all time
alias scat 'cat !* | tr "[A-Z]" "[a-z]"' Pipes all the files from the command line into "tr" to convert all uppercase to lowercase letter
alias fspace 'df | sort -n -r -t'TAB' +5 | sed -n 2p' Displays the filesystem with the most free space
alias egroup 'grep users /etc/group | sed -n "s/^.*://;s/,$USER//p"' Extract the line in /etc/group that contains users associated with the group
alias p]='ps -Af | egrep -i $USER' Displays all current processes associated with you
alias grub 'pr -t -o6 `grep -l \!:1 \!:2` | sed '\''s/\(.*\)\!:1\(.*\)$/ \*\*\* \1\!:1\2 \*\*\*/'\'' | more' Finds a word or phrase and marks the line containing the string with asterisks in the left and right margins. (great for source code debugging)
alias lr 'ls -ltF !* | head -15' List 15 files that were most recently created/modified
alias spath 'echo $PATH | awk -F: '\''{for(i=1;i<=NF;++i) {print $1}}'\'' | nl' Breaks and display the long path listing up into lines
alias vib 'cp \!:1 \!:1.bak; vi \!:1' Automatically make a backup file when you start editing a file using 'vi' editor. You can substitute 'vi' with your favorite editor
alias dtt 'dtterm -bg #000000 -fg #00ea0b -fn "*fix*bold*120*75*" &' Create a dttermial with black background and a medium-shade green forground color with a fixed bold 12-point font. You can substitute 'dtterm' with traditional 'xterm'


Return to CEE UCL HelpDesk Homepage Move to the Top of this page