unix directory structure

In Unix directory structure, what is the 2nd column from left all about? Using ls commands. .

Everything Linux 1798 This topic was started 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 on our website and join the conversation

You have already an account on our website? Use the link below to login.
Login
Create a new user account. Registration is free and takes only a few seconds.
Register
This topic is archived. New comments cannot be posted and votes cannot be cast.

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]