LinuxQuestions.org
Visit Jeremy's Blog.
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 04-26-2015, 03:54 AM   #1
Volcano
Member
 
Registered: Sep 2005
Posts: 184

Rep: Reputation: 15
navigation issue


I am confused with the navigation in linux.

what does navigation /../demo will mean ?

does it mean we go to / first , then which path ?
 
Old 04-26-2015, 04:19 AM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
'.' is current directory. '..' is parent directory of current directory.

But in this case '/../demo' there is no parent directory beyond the root directory '/'.

So this actually turns into '/demo'.
 
Old 04-26-2015, 04:56 AM   #3
Volcano
Member
 
Registered: Sep 2005
Posts: 184

Original Poster
Rep: Reputation: 15
Does ../ and /.. are same thing ? I am confused with the ordering of '..' to find its parent

Please guide.

Last edited by Volcano; 04-26-2015 at 04:58 AM.
 
Old 04-26-2015, 05:08 AM   #4
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
If '/' comes first then it means the top most directory starts from / (root of filesystem).

E.g. a directory '/usr/bin' and you are in /usr/bin by 'cd /usr/bin'.

Now 'ls ../' or 'ls ../sbin' shows files in /usr in former and /usr/sbin in latter.

Again when your in /usr/bin and run 'ls -l /..' shows files in / directory (root).
 
Old 04-26-2015, 05:43 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,361
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
...additionally
Quote:
Originally Posted by Volcano View Post
Does ../ and /.. are same thing ? I am confused with the ordering of '..' to find its parent
try these commands to illustrate above replies:
Code:
]$ cd /var/tmp
]$ pwd
]$ readlink -f ../
]$ readlink -f /..
 
Old 04-26-2015, 07:11 AM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,714

Rep: Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280
Think of the directory tree as implemented by multiple links.

/ is the root of the tree.

the name of a directory is the link to the subtree.

.. is a backward link to one level higher in the tree.

. is for ease of use - it is a link to the current level of the tree (it makes it easy to do an ls without having to remember where you are in the tree).
 
Old 04-26-2015, 10:09 PM   #7
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 12,885
Blog Entries: 18

Rep: Reputation: 3346Reputation: 3346Reputation: 3346Reputation: 3346Reputation: 3346Reputation: 3346Reputation: 3346Reputation: 3346Reputation: 3346Reputation: 3346Reputation: 3346
This article is a good primer on how to use the cd command, including

Code:
cd ..
cd -
and so on.

If you open a command prompt in Windows and run a dir command, you will also the


Code:
.
..
at the top of the file listing, just as you do when you run ls -a (list files -all, that is, including hidden files) in Linux.

Last edited by frankbell; 04-26-2015 at 10:10 PM.
 
  


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
keyboard navigation Damase Slackware 3 02-25-2008 07:32 PM
navigation of browser munna_dude Linux - Networking 2 02-10-2007 06:02 AM
LXer: Open Source presence at Institute of Navigation's Global Navigation Satellite Systems meeting in Fort Worth, TX next week LXer Syndicated Linux News 0 09-20-2006 04:21 PM
Navigation .. winsnomore LQ Suggestions & Feedback 0 11-16-2004 04:10 PM
file navigation yenonn Linux - Newbie 2 02-26-2003 03:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:16 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