Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I back up within a directory?

Posted on 2004-04-13
9
Medium Priority
?
284 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 375 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…
Suggested Courses

688 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