Special Aliases
Certain special aliases can be set in tcsh. The aliases are initially undefined. Once set, the commands they specify are executed when specific events occur. The following is a list of the special aliases and when they are executed:
-
beepcmd At beep.
-
cwdcmd When the current working directory changes.
-
jobcmd Before running a command or before its state changes. Like
postcmd, but does not print built-ins.-
helpcommand Invoked by the
run-helpeditor command. See the tcsh manpage for details.-
periodic Every few minutes. The exact amount of time is set by the
tperiodshell variable.-
precmd Before printing a new prompt.
-
postcmd Before running a command.
-
shellprogram If a script does not specify a shell, interpret it with program, which should be a full pathname.
Examples
Demonstrate the cwdcmd
alias:
[arnold@mybox ~]$alias cwdcmd 'echo now in $PWD'Set alias [arnold@mybox ~]$cd /tmpChange directory now in /tmp Output from alias [arnold@mybox /tmp]$cdChange back home now in /home/arnoldOutput from alias
Demonstrate the postcmd
alias:
[arnold@mybox ~]$alias postcmd 'echo now starting\!'Set alias [arnold@mybox ~]$ls -FC *.txtRun a command now starting! Output from alias adr.gdb.backcover.txt gdb.backcover.txt sol-d1-2.txt Output from command awkhomepage.txt sol-d1-1.txt
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access