.cshrc
is copied over from /etc/skel
because it exists there and that's what happens to the contents of /etc/skel
on (most) user account additions. However that's totally unrelated to sh
or ksh
; .cshrc
exists due to csh
being installed and supported since the 2BSD days (a tradition, at this point).
.profile
is only read by login shells, so commands there will not be picked up by new shells that are not login shells:
valen$ cd
valen$ ed .profile
215
a
echo .profile was run
.
wq
237
valen$ exec ksh
valen$ exec ksh -l
.profile was run
valen$
The ksh(1)
manual has docs on setting an ENV
environment variable that non-login instances of ksh
will read:
valen$ ed .profile
237
d
a
export ENV=$HOME/.profile
echo now with ENV set
.
wq
263
valen$ exec ksh
valen$ exec ksh -l
now with ENV set
now with ENV set
valen$ exec ksh
now with ENV set
valen$
Given the double-read of ~/.profile
with export ENV=$HOME/.profile
set, it may instead be better to have a different file, such as ~/.kshrc
as recommended by the manual that contains your custom aliases:
valen$ cat .profile
PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games
export PATH HOME TERM
export ENV=$HOME/.kshrc
valen$ cat .kshrc
alias cls=clear
valen$ exec ksh -l
valen$ alias | grep cls
cls=clear
valen$
.cshrc
?