LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-20-2011, 03:59 AM   #1
tomViolet
LQ Newbie
 
Registered: Aug 2007
Posts: 7

Rep: Reputation: 0
navigating symbolic links in shell


Hi all, when there is symbolic link of a directory on my filesystem and I cd myself in it using csh on xterm, navigating back using 'cd ..' gets me to the physical working directory of the symbolic link and not the directory I was previously in.

Is there any way to default the behaviour of cd so that directory traversal works ignoring the physical working directory of symbolic links?

Thank you in advance.
 
Old 09-20-2011, 04:41 AM   #2
igadoter
Senior Member
 
Registered: Sep 2006
Location: wroclaw, poland
Distribution: many, primary Slackware
Posts: 2,717
Blog Entries: 1

Rep: Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625
Hi, don't think it is possible at all. Can be many symbolic links pointing to the same directory. You can to jump using 'pushd' and 'popd' commands.
Code:
$ pwd
/home/piotr/.kde
$ pushd ./ 
~/.kde ~/.kde
$ cd ~/
$ pwd
/home/piotr
$ popd
~/.kde
$ pwd
/home/piotr/.kde
 
Old 09-20-2011, 04:41 PM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
. and .. are not just shortcuts of some kind, they're actual physical directory names existing in your file tree. . is defined at the file system level to always refer to the current physical working directory, and .. always refers to the parent of the current directory.

I don't know about csh, but bash, for example, sets an OLDPWD environment variable that holds the last directory you were in. Then you can use "cd -" as a synonym for "cd $OLDPWD". This is in addition to popd/pushd.

So check your shell documentation.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Help with symbolic links cmfarley19 Linux - General 2 08-25-2010 10:30 AM
Symbolic links Vs Hard links sulekha Linux - General 2 10-02-2008 07:03 AM
session variables not preserved when navigating thru links prabhatsoni Linux - Software 2 06-13-2005 01:15 AM
Symbolic Links Greg_courageous Linux - Newbie 1 05-10-2004 07:05 AM
Symbolic links bkmesenbrink Linux - Newbie 2 11-13-2002 11:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration