Random Linux+ Question #8

Discussion in 'Linux+' started by tripwire45, Jun 29, 2005.

  1. tripwire45
    Honorary Member

    tripwire45 Zettabyte Poster

    13,493
    180
    287
    You are on the command line on a Linux computer. You have been navagating the file system using the cd command. You have returned to your home directory but suddenly remembered that you want to see something in the last directory you had visited. You cannot remember exactly how to get back there. What simple command can you issue that will take you to the last directory you visited? Choose only one answer

    1. cd
    2. cd ..
    3. cd ~
    4. cd ~-
    5. cd -

    Answer later.
     
    Certifications: A+ and Network+
  2. AJ

    AJ 01000001 01100100 01101101 01101001 01101110 Administrator

    6,897
    182
    221
    Not a clue but 5 looks promising 8)
     
    Certifications: MCSE, MCSA (messaging), ITIL Foundation v3
    WIP: Breathing in and out, but not out and in, that's just wrong
  3. nugget
    Honorary Member

    nugget Junior toady

    7,796
    71
    224
    Number 2 for me.:rolleyes:
     
    Certifications: A+ | Network+ | Security+ | MCP (270,271,272,290,620) | MCDST | MCTS:Vista
    WIP: MCSA, 70-622,680,685
  4. Jakamoko
    Honorary Member

    Jakamoko On the move again ...

    9,924
    74
    229
    2 for me.
     
    Certifications: MCP, A+, Network+
    WIP: Clarity
  5. EMacd

    EMacd Bit Poster

    38
    3
    8
    5 for this one
     
  6. tripwire45
    Honorary Member

    tripwire45 Zettabyte Poster

    13,493
    180
    287
    I may have shot myself in the foot with this one. There apparently are two correct answers. The answer that I was going for was 4.: cd ~- which indeed will take you back to the most recent directory you visited but 5.: cd - is supposed to do the same thing. Trouble is, while cd ~- works flawlessly on my Debian, FC3, and NLD9 (SUSE 9.2) boxes, when I use cd - on those machines, the output is "OLDPWD not set"

    PWD stands for "print working directory". When you issue that command, the output is the directory you are currently located in. If I use "pwd" while I'm in my home directory, I get "/home/username". I did a search and while I can confirm what the command "cd -" is *supposed* to do, I cannot find out how to "set" OLDPWD so that it would actually work. :oops:
     
    Certifications: A+ and Network+
  7. Phoenix
    Honorary Member

    Phoenix 53656e696f7220 4d6f64

    5,749
    200
    246
    seems like the second option requires a variable to be set (some distros will set this), and hence doesnt technically mean it works


    for instance ll in fedora actuall runs the command ls -l --color=tty
    ll isnt however a real command :)
     
    Certifications: MCSE, MCITP, VCP
    WIP: > 0
  8. tripwire45
    Honorary Member

    tripwire45 Zettabyte Poster

    13,493
    180
    287
    So does that mean the only correct answer really is "cd ~-"?
     
    Certifications: A+ and Network+

Share This Page

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.