unix directory structure

This is a discussion about unix directory structure in the Everything Linux category; In Unix directory structure, what is the 2nd column from left all about? Using ls commands. .

Everything Linux 1800 This topic was started by , . Last reply by ,


data/avatar/default/avatar26.webp

151 Posts
Location -
Joined 2003-12-23
In Unix directory structure, what is the 2nd column from left all about? Using ls commands.

Participate in our website and join the conversation

You already have an account on our website? To log in, use the link provided below.
Login
Create a new user account. Registration is free and takes only a few seconds.
Register
This subject has been archived. New comments and votes cannot be submitted.
Jul 24
Created
Jul 24
Last Response
0
Likes
2 minutes
Read Time
User User
Users

Responses to this topic


data/avatar/default/avatar39.webp

336 Posts
Location -
Joined 2004-07-09
DefRef time again: the directory structure is the actual data structure describing your files.
 
What you refer to is the file list which is a representation of the directory structure
generated by the 'ls' utility.
(oh, and columns are numbered left to right with whitespace chars separating them
- if you're to use 'awk' or 'cut' or 'sort', you must know this well).
 
pedantically, then, you're wondering what the second column in the long or verbose
'ls' output means?
The column in between the file permission bits (column 1) and the file owner (column 3)?
 
It's the value of the "link count". A file is 'deleted' when the link count reaches 0,
at which point the zones used by the file are all marked 'free'.
 
Quick tutorial experiment to be performed in a directory where you have
write/create permission (say, for instance, your home/login dir):
 
[size:3][tt]touch test.fil
ls -l test.fil
cat >> test.fil
Here is the contents of my test file.
I have put content here so I can identify this file
as being the very one I created. The full reason
for doing this will soon be apparent.
CTRL-D ( <-- you type the Control-plus-'D' keys together)
ls -l test.fil ( <-- if you count up all the keystrokes including the Enter key..)
ln test.fil test2.fil
ls -l test*.fil ( <-- are you seeing double?)
ln -s test.fil test3.fil
ls -l test*.fil ( <-- hmm, symbolic links don't increase link count)
rm test3.fil
ls -l test*.fil
rm test.fil ( <-- remember, this was the name of the original file)
ls -l test*.fil
cat test2.fil ( <-- same old content, but now a different name)
[/tt]