Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ls

Posted on 1998-02-05
5
Medium Priority
?
541 Views
Last Modified: 2010-04-21
What stands the "total" for in the ls command
and why do I get different results
when typing ls -l and ls -la ?
0
Comment
Question by:shurengyla
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Accepted Solution

by:
christg earned 400 total points
ID: 2008766
ls -l is for a long list and ls -la will show you all the contents of a directory. ls -la will allow you the see the permissions of your current directory and the parents directory
0
 
LVL 3

Expert Comment

by:braveheart
ID: 2008767
If you read the manual page (type "man ls") it will tell you all about the different options for ls.

-l gives the long listing which tells you information about access and ownership, file size and last modified time, as well as the name of the file.

-a includes any files in the specified (or current) directory which begin with the "." character. These include "." which is a link in every directory to itself and ".." which is a link to the parent of every directory. The "." self-link is useful in case you have a file beginning with "-" which would otherwise be difficult to perform any operations on the file unless you prefixed it by "./". Special files in your home directory such as initialisation scripts and X resource files also typically begin with dot.

The total at the end of "ls -l" shows the total size (sum) of all the files in that directory, although the units may not be consistent from machine to machine.
0
 
LVL 1

Expert Comment

by:hwillekens
ID: 2008768
if you want to know the size of a directory, better use du -s *
0
 

Expert Comment

by:rmgopal
ID: 2008769
Hi shurengyla,

The answer to your questions are of two parts.

1) What stands the "total" for in the ls command?
    total stands for the total number of blocks occupied by the files listed using either 'ls -l' or 'ls -la'

2) why do I get different results when typing ls -l and ls -la ?
   'ls -l' lists the files in a particular directory. But when u  use 'ls -la' it lists all the files in that directory including the hidden files i.e) dot files like .login, any file which start with a dot (.). Whereas when u use 'ls -l' the hidden files will not be listed. So if u have hidden files in your directory, u will get different "totals" for 'ls -l' and 'ls -la"


Hope the above points answered your questions. Have a good day/night.

Thanks,
Ravi.
0
 
LVL 3

Expert Comment

by:braveheart
ID: 2008770
Hey, rmgopal, you seem to be making a habit of just rewording my answers. Don't you have any original thoughts, or do you just not read the question history before answering.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question