"cd.." doesn't work anymore.

adambyte

Registered
Why is it that the command "cd..." which used to take me up a level in the hard disk heirarchy now just gives me a "command now found" error? I think it hasn't worked since I installed Jaguar 10.2, but I'm not quite sure. Help, please. Should I reinstall the Mac OS?
 
Don't worry; this is really easy to fix. The command cd.. used to be just an alias for cd .. (note the space after cd.) To add default aliases, edit /etc/csh.login. The easy way to do it is with pico:

sudo pico /etc/csh.login

To add this particular alias, add this text to the end of the file:

Code:
alias cd.. 'cd ..'

In Pico, press Control-o to save and Control-x to quit.

After you do this, all new Terminal windows should have the alias.
 
You may wish to restore your tcsh environment to the way it was in OS X 10.0 and 10.1 (which will restore your cd .. and other familiar aliases):

Code:
sudo -s
echo "source /usr/share/tcsh/examples/rc" >> /etc/csh.cshrc
echo "source /usr/share/tcsh/examples/login" >> /etc/csh.login
echo "source /usr/share/tcsh/examples/logout" >> /etc/csh.logout
exit
 
Thanks guys, I was worried my BSD was broken. So, did this really change with 10.2? And if so, why would Apple make this subtle change? Do mose UNIX flavors NOT have that alias?
 
The default aliases seem to vary drastically in different forms of UNIX. The university Red Had machines have these:

alias cp='cp -i'
alias l='ls -l'
alias l.='ls -d .[a-zA-Z]* --color=tty'
alias ll='ls -l'
alias ls='ls --color'
alias rm='rm -i'
alias vi='vim'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

The moral of the story is always run alias to see what commands might have been remapped.
 
Most UNIX's don't do any aliases by default. Plus the 'cd..' alias is just a hack to fix a stupid thing that DOS put into place because someone at MS was too lazy to put in a space. So some people who are used to using the stupid "cd.." in DOS, instead of the proper "cd .." in DOS get confused when they can't use the improprer form of the command on a UNIX box, so some folks put in an alias to correct their inability to type. :)

Ofcourse, this is just a pet peeve of mine, so ignore my ranting :)

Brian
 
Back
Top