LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 02:54 AM   #1
Volcano
Member
 
Registered: Sep 2005
Posts: 225

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, 03: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, 03:56 AM   #3
Volcano
Member
 
Registered: Sep 2005
Posts: 225

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 03:58 AM.
 
Old 04-26-2015, 04: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, 04:43 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
...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, 06:11 AM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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, 09:09 PM   #7
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,382
Blog Entries: 28

Rep: Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164
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 09:10 PM.
 
  


Reply



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 06:32 PM
navigation of browser munna_dude Linux - Networking 2 02-10-2007 05: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 03:21 PM
Navigation .. winsnomore LQ Suggestions & Feedback 0 11-16-2004 03:10 PM
file navigation yenonn Linux - Newbie 2 02-26-2003 02:36 AM

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

All times are GMT -5. The time now is 09:26 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
Open Source Consulting | Domain Registration