Solved

How do I back up within a directory?

Posted on 2004-04-13
9
274 Views
Last Modified: 2013-12-27
Seems like a simple question but I have not been able to find the answer.....Is there a way to backup a level within a directory in Solaris?  I usually will dig down into a multilevel directory and then cd back out to the main area and then have to dig back down into the directory to get to a level that was right above where I was previously.  Is there a command that will let me back my way out of a directory?
0
Comment
Question by:roduno
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 125 total points
ID: 10820108
'cd ..' will take you up one level, 'cd ../../' two levels, and 'cd ../../other-dir' will go up two levels and down into "other-dir."
0
 
LVL 48

Expert Comment

by:Tintin
ID: 10820111
There's a number of approaches (of which some are shell dependent).

In ksh/bash, you can do

cd -

to cd to the last directory you where in.

In csh/tcsh, you have the pushd and popd functions to pop/push directories onto a stack.

Another approach is to set up aliases for your favourite dirs, eg:

alias mydir='cd /path/to/some/long/dir'

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10820510
pushd ./next/level
echo in `pwd` now
pushd
echo back in `pwd`
pushd
echo no in `pwd` again
popd
0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
LVL 51

Expert Comment

by:ahoffmann
ID: 10820518
s/no/now/

(sorry for typos)
0
 
LVL 12

Expert Comment

by:stefan73
ID: 10820985
Hi roduno,
Yes, "cd .." works. But be careful when your cd path contains soft links. ".." is a hard link to the parent directory. "cd .." might not get you back to the parent directory you expected.

Cheers,
Stefan
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10822383
> cd ..
hence pushd, it does not have this problem (depending on shell, OS, or whatever)
;-)
0
 
LVL 12

Expert Comment

by:stefan73
ID: 10823158
ahoffmann,
Yes, very helpful.

Stefan
0
 

Author Comment

by:roduno
ID: 10838612
I must have a faulty or weird os because none of the above suggestions worked.  All I get when I try them is "not found".
0
 

Author Comment

by:roduno
ID: 10838725
My bad..... I wasn't putting a space between the cd and the ..
I got it now!  Thanks alot!
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question