# Where's the good UNIX ".cshrc" file gone?



## sdepraz (Jun 30, 2002)

I'm quite a newbie on UNIX systems. I was used to the .cshrc file on SUN station, but I can't find it on OSX. Where's gone?

I use .cshrc file to set aliases, which helps to spare your keyboard life time!

Can anybody help me? How can u set aliases in OSX such that, for example, when u type:

"carrot" it launches the command "rm -r *"

Thanks !


Sam


----------



## lethe (Jun 30, 2002)

well OSX uses tcsh by default, so feel free to use your .cshrc


```
% cat > .cshrc
alias carrot "rm -r *"
^D
```

or else use TextEdit.app. making sure that you save as ascii text, not rtf.

then exit, and start a new shell.  its just like your old solaris account.


----------



## sao (Jun 30, 2002)

Type in terminal:

 cd ~ (Make sure you're in your home directory)

 Then:

 pico .cshrc (Create a .cshrc file that runs when new terminal are started)

 This is what I have in my ~/.cshrc file:


```
source  /sw/bin/init.csh
date
set prompt="\! [%{\033[32m%}Sao%{\033[0m%} @%{\033[36m%}%/%{\033[0m%}]%{\033]0;Sao @ %/\007%} $
alias l         'ls -Ahl --color=always'
alias lh        'ls -Al --color=always'
alias ls        'ls -A --color=always'
alias m         'more'
alias top       'top -u -s 10'
set histfile = .history
set savehist = ( 250 merge )
set complete=enhance
alias lo        'logout'
alias fword    ' grep -i \!* /usr/share/dict/web2 '
alias back     'cd -'
alias h        'history'
alias psh      'pushd'
alias pop      'popd'
alias md       'mkdir'
alias krm      'rm -i'
alias r        'rehash'
alias cl       'cd \!* ; ls'
```


 Cheers...


----------



## sdepraz (Jun 30, 2002)

Well thanks guys, that's fine working!

I pay you a beer one of theses days!

See ya


Sam


----------



## iconara (Jul 3, 2002)

tcsh can be configured either by the ol' .cshrc or .tcshrc conf-files, or by placing a bunch of files in ~/Library/init/tcsh (I'm writing from memory here, not on my X-box now) called alias, environment, rc and stuff. Place the corresponding commands in them and it works just like .tcshrc, but modularized. Check the tcsh man page for more info (think that was where I found it). Keeps your home directory nice and clean...


theo


----------



## sao (Jul 3, 2002)

Anything that's in a .tcshrc file could just be inserted into a .cshrc file and the former deleted. 

That whole pile of files in ~/Library/init/tcsh are really only "sourced" as necessary, so you can similarly throw any such commands into either your .login or .cshrc file. 

 Seems weird that Apple have tcsh singled out this way (what about zsh or bash users?). 


 Cheers...


----------



## Koelling (Jul 5, 2002)

anyone else have good ideas of things to put into the .cshrc file? sao gave me the idea to 

alias play mpg123 -Z --list ~/musiclist/music.txt 

what this does is allow me to type play to get the command line mp3 player to start playing the playlist in music.txt (which includes full path names of course)

anyone else have ideas for space and or time saving aliases or .cshrc items?


----------



## deraven (Jul 7, 2002)

alias sslog "cat /private/var/log/system.log | grep"

sslog = Search System Log

So,

>sslog sendmail

give me a quick output of sendmail activity.

I do a lot of tweakin to this system, so I need to see log entries quite frequently.

Other variations:

swlog = Search Web Log
oslog = Search Old System Log (alias oslog "zcat /private/var/log/system.* | grep"
owlog = Search Old Web Log (similar to above)
salog = Search All Logs (alias salog "cat /private/var/log/* | grep"


----------



## sao (Jul 16, 2002)

Small collection of aliases:


```
alias gpid      'ps wwax | grep "\!*" | grep -v grep | awk '\''{print $1}'\'''
alias zfp       'ps wwaxl | egrep -i "\!:1|PPID CPU"' # find process
alias zloc      "locate \* | perl -ne 'print if m#\!*#i'" 
alias zrmx      'mail -f ~/mbox'
alias ll        'ls-F -lAh --color \!* | more'
alias zsnf      'sudo tcpdump -i en0'
alias zc        'awk "BEGIN{ print \!* }" '   # cli calculator - zc 5*5
alias zmx       'chmod u=rwx \!*'
alias zdv       'df -h'
alias ztp       'top -u -s3 10'
alias zw        'echo $\!:1'    # echo $var -> zw var
alias zmem      'vm_stat'
alias ztsl      'tail -vf -n50 /var/log/system.log'
alias srchfrlmn "cat \!:1 | grep lmn"
```

 Cheers...

PS: Using fink here.


----------

