This is a very useful .cshrc file for anyone out there that still uses UNIX.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | # /etc/csh.login: This file contains login defaults used by csh and tcsh. # $Thanks 2> http://www.grymoire.com/Unix/Csh.html # Set up some environment variables: #source ~/.complete if ($?prompt) then umask 022 set cdpath = ( /var/spool ) set notify set history = 1000 set savehist = 500 setenv MANPATH /usr/local/man:/usr/man:/usr/X11R6/man setenv MINICOM "-c on" setenv HOSTNAME "`uname -n`" setenv LESS "-M" setenv LESSOPEN "|lesspipe.sh %s" setenv WINDOWMANAGER "fvwm-themes-start" setenv DOOMWADDIR "/usr/local/games" set path = ( $path /usr/X11R6/bin /usr/games $HOME/bin /usr/local/games ) endif # If the user doesn't have a .inputrc, use the one in /etc. if (! -r "$HOME/.inputrc") then setenv INPUTRC /etc/inputrc endif # I had problems with the backspace key installed by 'tset', but you might want # to try it anyway, instead to the 'setenv term.....' below it. # eval `tset -sQ "$term"` setenv term linux # if ! $?TERM setenv TERM linux # Set to "linux" for unknown term type: if ("$TERM" == "") setenv TERM linux if ("$TERM" == "unknown") setenv TERM linux # Set default POSIX locale: setenv LC_ALL POSIX setenv traditional_complete alias cls 'clear' alias lu 'ls -hula' alias tarunpack 'tar -xvf' alias bz2unpack 'tar -jxvf' # Set the default shell prompt: printf "\n\n____----------------_____\n\n" if (-x "/usr/bin/fortune") then `testout` endif printf "\n-----_________________-----\n\n" set prompt = "\[%d %t %y\]\n$TERM. \[`uname -vmr`\]\n\[%n@$HOSTNAME\]:%~%# " # Set up the LS_COLORS environment variable for color ls output: #eval `dircolors -c` # Notify user of incoming mail. This can be overridden in the user's # local startup file (~/.login) #biff y # Append any additional csh scripts found in /etc/profile.d/: [ -d /etc/profile.d ] if ($status == 0) then set nonomatch foreach file ( /etc/profile.d/*.csh ) [ -x $file ] if ($status == 0) then source $file endif end unset file nonomatch endif |
Some very nice shell aliases for streamlining your shell usage.
# Set up aliases alias mv='nocorrect mv' # no spelling correction on mv alias cp='nocorrect cp' # no spelling correction on cp alias mkdir='nocorrect mkdir' # no spelling correction on mkdir alias j=jobs alias pu=pushd alias po=popd alias d='dirs -v' alias h=history alias grep=egrep alias ll='ls -l' alias la='ls -a' alias cls='clear' alias lu='ls -Fula -h' # More useful Aliases. alias tarunpack='tar -zxvf' alias bz2unpack='tar -jxvf' alias mc='mc -a' alias rm='rm -i' alias rm='cp -i' |
How to use ls to only list directories.
# List only directories and symbolic # links that point to directories alias lsd='ls -ld *(-/DN)' |
Use ls to only list dotfiles.
# List only file beginning with "." alias lsa='ls -ld .*' |
A simple function to check for bad symbolic links.
function badlink() # From Atomic magazine #43 August 2004. http://www.atomicmpc.com.au { DEFAULT=$(tput sgr0); FILELIST=.badlink.list [ -e $FILELIST ] && $( rm -fr $FILELIST ) function checklink() { for badlink in $1/*; do [ -h "$badlink" -a ! -e "$badlink" ] && echo \ \"$badlink\" >> $FILELIST [ -d "$badlink" ] && checklink $badlink done } for directory in `pwd`; do if [ -d $directory ] ; then checklink $directory; fi done if [ -e $FILELIST ] ; then for line in $(cat $FILELIST); do echo $line | xargs -r rm | echo -e "$line \ -removed" echo done rm -fr $FILELIST else printf "Bad symlinks not found.\n\n" fi } # End Atomic function. |
Put this code in your .zshrc file to load a nice custom prompt.
autoload -U compinit compinit autoload -U promptinit; promptinit prompt clint gray25 wheat1 |
Print information about your user in the terminal.
if [ -x /usr/bin/finger ] ; then INFO=$(finger -lmps $LOGNAME | sed -e "s/On/Logged in/g" | grep "since" ) else INFO=$(uname -msov) fi |