LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-21-2007, 08:08 AM   #1
veeramani
Member
 
Registered: Apr 2006
Posts: 33

Rep: Reputation: 15
Post what is this ls?


hi,

When i type the command , i can get three terms as follows.what is this? I think the first one is number of files and directories,what about the other two?

ls -l |wc
35 309 2360
 
Old 03-21-2007, 08:12 AM   #2
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
from man wc:
Code:
DESCRIPTION
       Print byte, word, and newline counts for each FILE, and a total line if
       more than one FILE is specified.  With no FILE, or when FILE is -, read
       standard input.
So it seems what you're seeing is the number of bytes, the number of words, and the number of newline counts for the output of ls.

edit: although I'm not sure if the last number (2360) is perhaps the total line counts since there's likely to be more that one file. It depends on how it processes stdin.

Last edited by pwc101; 03-21-2007 at 08:14 AM.
 
Old 03-21-2007, 08:14 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Take a look at "man wc" Hint: it is counting three parameters--one of which is the # of words

Your guess on the first one is sort of correct, but not directly....
 
Old 03-21-2007, 08:18 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by pwc101

edit: although I'm not sure if the last number (2360) is perhaps the total line counts since there's likely to be more that one file. It depends on how it processes stdin.
It's processing the output of ls -l as a text file---it knows nothing of the meaning--it only counts lines, words, and bytes in the text stream.
 
Old 03-21-2007, 08:22 AM   #5
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by pixellany
It's processing the output of ls -l as a text file---it knows nothing of the meaning--it only counts lines, words, and bytes in the text stream.
Ah, thanks for clearing that up. I wasn't sure if it would receive the data from ls -l as a single event, or as a series of events (each line of the output, for example), thereby treating each as a separate event.

I'm still pleasantly surprised by how much I don't know about GNU/Linux!
 
Old 03-21-2007, 08:46 AM   #6
veeramani
Member
 
Registered: Apr 2006
Posts: 33

Original Poster
Rep: Reputation: 15
Wow .,, Thanks a lot for you all
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration