LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-10-2013, 09:59 AM   #1
jd142
LQ Newbie
 
Registered: Jul 2013
Posts: 1

Rep: Reputation: Disabled
changing directories "sideways"


Hi,

I have the following directory structure:

/home/user1/BigFolder/SmallFolder/ImportantStuff
/home/user2/BigFolder/SmallFolder/ImportantStuff
/home/user3/BigFolder/SmallFolder/ImportantStuff

If I am in /home/user1/BigFolder/SmallFolder/ImportantStuff and want to change to ImportantStuff in user3's folder, I have to cd ../../../../user3/BigFolder/SmallFolder/ImportantStuff.

Is there a command line way to say "go to this exact same subdirectory, but in the User3 folder?"

Thanks!
 
Old 07-10-2013, 10:49 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,256

Rep: Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686
How about:
Code:
cd ${PWD/1/3}
This would of course assume that there are no other 1's in the path prior to the one we need.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Use "pushd" and "popd" for quick switching between directories LXer Syndicated Linux News 0 07-13-2012 08:40 PM
Copying files and sub-directories of a directory except the directories named ".abc" sri1025 Linux - General 2 08-24-2010 09:53 AM
"directories changing to unknown file types" Mr.Raj Linux - General 6 11-15-2008 02:44 AM
K3b: - Howto re-dock "Directories" and "Contents" windows back into the main window? hagies Linux - Software 4 04-26-2006 09:38 AM
mambo: changing "Poll" to say "Encuesta" eantoranz Linux - Software 2 03-28-2006 12:35 PM


All times are GMT -5. The time now is 02:42 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration