next up previous contents
Next: Comparison of Shells Up: tcsh shell Previous: tcsh shell

tcsh builtin commands, startup files, variables, etc.

Tcsh supports C shell builtins and variables with the additions and specification described in the following tables.


Tcsh Shell Built-in Added Commands
log list terminals affected by watch
sched list/schedule scheduled command execution
ls-F same as ls --F to append flag-id for file type (see man)
telltc list terminal capacity
settc cap val sets the terminal capacity cap to the val value
which builtin faster search of command function
where builtin faster search of command path
echotc act on terminal capabilities, move cursor on screen (emulates tput)
complete set syntax and command for completion operation (see man)
uncomplete reset complete and allow any completion for any command
tcsh supports also system dependent builtins for aix, etc. (see man pages)



Example of the
sched built-in:

> echo "example of tcsh scheduling"
> sched 10:38 echo "sched time reached at `date`"
> sched
     1  Tue Jul 13 10:38        echo sched time reached at `date`
> date
Tue Jul 13 10:37:11 MET DST 1999
> sched time reached at Tue Jul 13 10:38:01 MET DST 1999
In this example an echo command is scheduled for execution at 11:32. Then the sched command without arguments is used to check scheduled action. The following date command informs the user that scheduling time is near, finally scheduled event is run.

Tcsh supports a search mechanism to find already typed commands in the history buffer. The search syntax in bound to metacharacter and to editing style, either emacs or vi. The history search works only if the terminal is conveniently configured. For unknown terminal setup a working history search is given by:

> echo "searc abc string in history"
> history | grep abc
    42  14:50   cp a.a abc
    68  15:38   history | grep abc

Tcsh creates dynamic environment variables HOST, HOSTTYPE, uid, gid. HOST is the result of the system call gethostname. HOSTTYPE specifies the cpu architecture:

> echo "host is: $HOST - cpu is:  $HOSTTYPE"
host is: newhost.site.orgz.place - cpu is:  alpha
HOSTTYPE can be used to set a machine dependent path for executables. If the same software must run on different platforms, such as alpha, vax, decstation where the names are also the values assigned to HOSTTYPE and the implementors create subdirectories of the type proj.machine where machine has the same name as HOSTTYPE, then on any platform the specific executable projexe is addressed by ~/proj.$HOSTTYPE/projexe. For a full list of supported cpu types check the man tcsh(1) pages. Environment dynamic variables uid, gid are set to the current real user ID/GID.

A new supported alias is cwdcmd that enables execution of a command after changing the working directory, if set with a valid command, such command will be executed after changing the value of $cwd, where the full current path is stored. A possible usage of cwdcmd is the capability of changing the title bar and the icon name of a terminal running X according to the current directory path.


Tcsh Shell Startup Files
/etc/csh.cshrc try to source first
/etc/csh.login try to source if tcsh is a login shell
$home/.tcshrc try to source first at user login level
$home/.cshrc try to source if $home/.tcshrc not found
$home/.login try to source if tcsh is a login shell
/etc/csh.logout source first on exit
$home/.logout source on exit if tcsh is a login shell
on some systems startup filenames may be different



Tcsh Command Line Options
-d force load of directory stack
-D set environment variable var to value val ( -Dvar=val)
-F use fork instead of vfork
-l make tcsh behave as a login shell
-m allow reading of another user's .cshrc
-q make the shell accept SIGQUIT (debugger)



Tcsh Shell File Inquiry
-r read access
-w write access
-x execute access
-e existence
-o ownership
-z zero size
-f plain file
-d directory
-l symbolic link (*)
-c character special file
-b block special file
-p named pipe ( fifo) (*)
-u uid bit set
-g gid bit set
-k sticky bit set
-s non-zero size
-t open file descriptor
-S socket special file (*)
-X executable in path or builtin
(*) - Systems without this file type return .false.



Tcsh Shell Environment Variables
HPATH Help path of in-line documentation for commands if any
LANG character environment for internationalization
LC_TYPE change character type handling
NOREBIND inhibits rebind of printable characters
PATH path of commands
SHLVL current shell nesting ( 1..n)
TERM terminal specification
LINES terminal lines
COLUMNS terminal columns
TERMCAP terminal capability
SYSTYPE current system type
Some variables may not be defined



Tcsh Shell Specific Variables - Part 1
addsuffix suffix directories with / (slash)
ampm show time in am/pm format
autocorrect correct mis-spelled names
autoexpand invoke expand-history
autolist list possibilities
autologout logout if inactive
backslash_quote change parse rules
correct try to correct spell errors
dextract extract pushed directory
dirsfile directory stack file
dirstack list of dirs in stack
dunique push in stack only new dirs
echo_style set echo style type
edit use input editor
fignore ignore file name suffix (ex. .f)
gid current real GID
histlit set history literal value
histfile set history file
history history events
inputmode =insert or =overwrite chars in command line
listjobs list suspending jobs with ( =long) option
listlinks resolve links in ls
listmax max. line (see vms /page qualifier)
listmaxrows as above for rows
matchbeep control beep
nobeep disable beep
nokanji disable kanji
nostat do not wait stat, for fast dir access (see /afs)
oid organization ID
printexitvalue print exit value
prompt primary prompt
prompt2 secondary prompt
prompt3 spell prompt
pushdtohome customize pushd
pushdsilent do not print stack at pushd/popd
recexact recognize exact match
recognize_only_executables list only executables when completing commands
rmstar prompt user before rm *
savedirs restore directory stack
savehist history items no. to save
shlvl shell level
showdots show hidden files completing commands



Tcsh Shell Specific Variables - Part 2
symlinks customize link path translation
tcsh current tcsh version
term terminal type
tperiod wait period
tty tty name
uid current real ID
version version info
visiblebell change bell to flash
watch list watch events
who format string for watch printouts
wordchars list non alphanumeric characters



Tcsh Shell Special Aliases
cwdcmd run command after directory change
periodic run command every tperiod minutes
precmd run command before next prompt
beepcmd run command when bell sounds



next up previous contents
Next: Comparison of Shells Up: tcsh shell Previous: tcsh shell
Marisa Luvisetto
2001-02-05