$title = "Creating a command alias"; $area = "Unix Support"; $metadata = "unix, commands, shell, alias, unalias, environment"; $pfloc = ""; require '/usr/local/wwwdocs/ucs/fragments/header.phtml'; require '/usr/local/wwwdocs/ucs/fragments/header-bc.phtml'; ?>
Assigning an alias is done with the command:
alias name definition
alias del 'rm -i'
creates the alias del for the command rm -i which prompts for confirmation that you want to remove a file.
alias dir 'ls -l | more'
creates an alias for two commands combined by a pipe.
unalias del
removes the alias called del from the current session.
alias unsafe "echo Vulnerable: ; find $HOME -perm -o+w -type -l"
Here, the alias "unsafe" represents two commands. The first (echo) prints a heading and the second invokes Unix's find operation to scan the home directory tree for any files which permit writing by others ( -perm o+w). It does not print symbolic links ( -type -l) which appear to to be writeable to anyone.