LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   command to go up a level in the shell (https://www.linuxquestions.org/questions/linux-newbie-8/command-to-go-up-a-level-in-the-shell-274701/)

dr_zayus69 01-06-2005 03:11 PM

command to go up a level in the shell
 
is there a command to travel up a directory in the terminal? like if i was in /home/x/y could i use a command to go back to x?

Andrew Benton 01-06-2005 03:15 PM

Code:

cd ..

dr_zayus69 01-06-2005 03:25 PM

thanks

itsjustme 01-06-2005 03:36 PM

Fun with dots.
 
Fun with dots.

In addition to the answer from Andrew Benton,

. is the current directory

.. is the parent directory of the current directory.

If you are in say, /home/drzayus, and want to copy a file there, say /var/log/somelog.log, you could:
$ cd
$ pwd
/home/drzayus
$ cp /var/log/somelog.log .

Then you would have a copy of that log in your home directory.

Also, then, I suppose you could run:
$ cp /var/log/somelog.log ..

which would copy the file to drzayus' parent directory, /home.

(I'm not currently on a linux machine to be able to test that second example
, but it should work.)

The . and .. can come in handy.


All times are GMT -5. The time now is 08:32 PM.