11

When I entered the -al attribute with the ls command, I got the following:

anupam@JAZZ:~/blog$ ls -al
total 76
drwxrwxr-x 13 anupam anupam 4096 Aug 28 21:45 .
drwxr-xr-x 34 anupam anupam 4096 Aug 28 20:52 ..
drwxrwxr-x  8 anupam anupam 4096 Aug 28 12:19 app
drwxr-xr-x  2 anupam anupam 4096 Aug 28 12:19 bin
drwxrwxr-x  5 anupam anupam 4096 Aug 28 12:19 config
-rw-rw-r--  1 anupam anupam  154 Aug 28 12:19 config.ru
drwxrwxr-x  3 anupam anupam 4096 Aug 28 12:37 db
-rw-rw-r--  1 anupam anupam 1339 Aug 28 12:19 Gemfile
-rw-rw-r--  1 anupam anupam 2871 Aug 28 12:19 Gemfile.lock
drwxrwxr-x  7 anupam anupam 4096 Aug 28 21:45 .git
-rw-rw-r--  1 anupam anupam  466 Aug 28 12:19 .gitignore
drwxrwxr-x  4 anupam anupam 4096 Aug 28 12:19 lib
drwxrwxr-x  2 anupam anupam 4096 Aug 28 12:29 log
drwxrwxr-x  2 anupam anupam 4096 Aug 28 12:19 public
-rw-rw-r--  1 anupam anupam  249 Aug 28 12:19 Rakefile
-rw-rw-r--  1 anupam anupam  478 Aug 28 12:19 README.rdoc
drwxrwxr-x  8 anupam anupam 4096 Aug 28 12:19 test
drwxrwxr-x  6 anupam anupam 4096 Aug 28 12:33 tmp
drwxrwxr-x  3 anupam anupam 4096 Aug 28 12:19 vendor

What does each column mean, and what does the total 76 signify here?

25

The ls -al command is a combination of ls -l (use a long listing format) and ls -a (do not ignore entries starting with .)

The result is a long list (the ls -l part) with (from left to right):

  • filetype
  • file permissions
  • number of links
  • owner name
  • owner group
  • file size
  • time of last modification
  • the name of the file or directory

while the ls -a means that hidden files are listed as well.

see also man ls (as always man is the first source of information), and this link.

A little more explanation on what you see

The output starts with the number of disc blocks, used by the directory (in your case 76). From the GNU docs:

For each directory that is listed, preface the files with a line ‘total blocks’, where blocks is the total disk allocation for all files in that directory. The block size currently defaults to 1024 bytes, but this can be overridden.

Then:

  • the first character describes wether it is a directory (d) or a file (-) (or some other file type, see the docs for a complete listing)

File permissions:

  • the permissions in a nine-character section (3x3 for owner / group / other users)

Links

  • The number of links is the number of hard links to the file. For a directory, the number of hard links is the number of (immediate) subdirectories plus the parent directory and itself.

Owner

  • name of the owner
  • name of the (owner) group

File size

  • You see many files with the size of 4096, which is the minimum size for a directory on ext3 and ext4.
  • Thanx sir,You gave me a clear understanding of what exactly I was looking for.. – lazarus Aug 28 '14 at 17:37
4

ls - list directory contents

You have 76 directories in /home/blog

drwxrwxr-x - These are the permissions for each one

The number after the permissions is the number of file/folders/links in this folder

After that the current user

After that the folders owner

Next is the group ID for the group the file belongs too.

Next is date and time the file was modified

The far right entery is the name of the folder

You can append ls with other commands for example

ls -a

Displays hidden files (starting with .)

You can find all the commands here

  • 76 directories in /home or in /home/blog ? – lazarus Aug 28 '14 at 16:35
  • sorry /home/blog/ I assumed you were just in /home – Mark Kirby Aug 28 '14 at 16:36
  • Okay sir,then what does ,13 means in [drwxrwxr-x 13 anupam anupam 4096 Aug 28 21:45 .] and 34 means in[drwxr-xr-x 34 anupam anupam 4096 Aug 28 20:52 ..] – lazarus Aug 28 '14 at 16:40
  • 1
    The 76 does not indicate the number of directories inside the directory which ls shows. See this example: pastebin.com/S411HeJG There are clearly no directories inside the one shown by ls, but it says 8 as total. – Andrea Lazzarotto Aug 28 '14 at 18:40
  • The total number of file links and folders but ls ONLY lists folders – Mark Kirby Aug 28 '14 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.