what is . and .. ?


 
Thread Tools Search this Thread
Operating Systems Solaris what is . and .. ?
# 1  
Old 12-15-2008
what is . and .. ?

Hi All,

When we go inside a directory and give ls -al , we get the list of files & Directory inside the directory and hidden files.. and also we get 2 directories as . & .. and if we try to cd . we remain in the current directory and cd.. takes to the parent directory . My question is are these directories only for navigating between directories or there is some other purpose of these directories?Smilie
# 2  
Old 12-15-2008
'.' is the present working directory and '..' is the parent directory. They're handy for scripts where you need to move data around while remaining lazy in your scripting and using relative paths.

Code:
 ls -A

will suppress them from output.

Note: They are not UNIX specific. Windows command prompt will also output '.' and '..' in 'dir' output.
# 3  
Old 12-16-2008
when create '/a' -> . in 'a' have same inode with 'a' and .. in 'a' have same inode with '/'
=> '/' have 1 more link count
'a' have 2 link count -> 'a' and . in 'a'

when create /a/b -> .. in 'b' have same inode with 'a' , so 'a' will have 3 link count, 'b' have 2.

column 2nd in command 'ls -l', it is link count. With a directory, the link count - 2 = number of directory in it.
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question