From Linux Bash Shell Scripting Tutorial Wiki
Jump to navigation Jump to search

The .login file is used by csh and tcsh as a startup file. We put commands that need to be run only once per login in this file.


At login, a new shell starts. For the csh or tcsh, if the user has a file named .login in the home directory, it is run at startup to configure the login shell. So you put commands that only need to run once in the .login file. Otherwise, everything else should go in the .chsrc file you always want to run.

Viewing .profile file

Use the cat command or more command/less command as follows to see the contains of the .login file:

cat ~/.login
more ~/.login
.login - the csh or tcsh shell login script
.login - the csh or tcsh shell login script

Sample .login file

Taken from the OpenBSD:

# $OpenBSD: dot.login,v 1.6 2015/12/15 16:37:58 deraadt Exp $
# csh login file

if ( ! $?TERMCAP ) then
	if ( $?XTERM_VERSION ) then
		tset -IQ '-munknown:?vt220' $TERM
		tset -Q '-munknown:?vt220' $TERM

stty	newcrt crterase

set	savehist=100
set	ignoreeof

setenv	EXINIT		'set ai sm noeb'

if (-x /usr/games/fortune) /usr/games/fortune

See also