Do not understand grep output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Do not understand grep output
# 1  
Old 10-11-2013
Do not understand grep output

In my directory I have two files and one subdirectory. When I run

Code:
 ls -l |grep -v ^d

I get the following output:

total 8
-rwxrwxrwx 1 qms qms 254 Oct 3 16:00 file1.txt
-rwxrwxrwx 1 qms qms 7167 Oct 11 15:46 file2.txt

Can you explain what is total 8 if the number of files is 2 and is there a way to disable that total message?

Thanks
# 2  
Old 10-11-2013
That's the block size that the listed files occupy.

Run the ls -ls command and you'll see that the numbers to the far right of the listing add up to the number next to total.
# 3  
Old 10-11-2013
That is the total number of file system blocks, including indirect blocks, used by the listed files.

Just to mention - you can use -h (ls -lh) to convert this in human readable format
# 4  
Old 10-11-2013
With grep -v you remove ANY MATCHING regex.
And yes, just like you hid the dirs...

Code:
ls -l |grep -v ^[dt]

hth
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can't understand script output

New to korn shel1 and having an issue. The following is suppose to read the parameter values from files in a source directory and then pass them on to a log file in a different directory, The ArchiveTracker scripts is suppose to call the parameterreader script to exact the parameter values and... (3 Replies)
Discussion started by: bayouprophet
3 Replies

2. UNIX for Advanced & Expert Users

unable to understand the output of TRUSS command

Hi, I am trying to set ulimit for soft stack unlimited, but this is not taking effect, after tracing the ulimit -a unlimited command, the below output was generated, which i am unable to comprehend. Could any one help me with this? prcbap1-r10prod: truss -d ulimit -s unlimited Tue Dec 30... (2 Replies)
Discussion started by: NasirAbbasi
2 Replies

3. UNIX for Dummies Questions & Answers

Not able to understand this output

I am hitting this command: dvlna021-(/cm/ims/dev/gds-scheduler/10/app/Software/active/Soft/conf)->ls -lrt gds_userenv_* This is the output lrwxrwxrwx 1 aimse was 65 Jul 31 12:56 gds_userenv_scheduler_2.ksh -> /cm/ims/dev/gds-scheduler/10/app/conf/gds_userenv_scheduler_2.ksh ... (2 Replies)
Discussion started by: Nsharma3006
2 Replies

4. Shell Programming and Scripting

How to grep the desired output and output to a file?

currently I have process from a raw file to this stage ALTER TABLE "EXCEL_ADMIN"."TC_TXN_VOID" ADD CONSTRAINT "PK_TC_TXN_VOID" PRIMARY KEY ("TC_TXN_IID") ALTER TABLE "EXCEL_ADMIN"."TC_TXN_AMT" ADD CONSTRAINT "PK_TC_TXN_AMT" PRIMARY KEY ("TC_TXN_AMT_IID") ALTER TABLE... (10 Replies)
Discussion started by: jediwannabe
10 Replies

5. Red Hat

Grep doesn't understand escape sequence?

I ran the following grep and sed command. grep "\t" emp.txt sed -n '/\t/p' emp.txt grep treated the '\' as to escape t and took the pattern as literal t whereas sed took the pattern as tab. That means , grep doesn't understand escape sequence!!!!!! what to do to make grep... (8 Replies)
Discussion started by: ravisingh
8 Replies

6. UNIX for Dummies Questions & Answers

Not able to understand the output of w command

I have taken putty session of a server from two separate machines namely HOST1(3 sessions) and HOST2(1 Session) . However w command says there are 5 users Confused over the output any clue will be appreciated. # w 09:29:36 up 34 days, 15:48, 5 users, load average: 0.62, 4.33, 8.16 USER ... (3 Replies)
Discussion started by: pinga123
3 Replies

7. UNIX for Dummies Questions & Answers

Unable to understand ps output.

I m executing ps command and sorting it according to memory usage. Please find the output of the command. # ps aux --sort pmem USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 2060 624 ? Ss 01:54 0:00 init root 2 0.0... (1 Reply)
Discussion started by: pinga123
1 Replies

8. Shell Programming and Scripting

I can't understand sed error output.

Hey forum, I have a problem with a script what used to work, but suddenly is not working anymore. I have been trying different things for an hour now and I give up :D . #!/bin/sh asukoht=`pwd` template=$1 for values in... (4 Replies)
Discussion started by: mario8eren
4 Replies

9. Shell Programming and Scripting

Need to understand the output of last command

root@desktop:~# last reboot | head -1 reboot system boot 2.6.31-17-generi Tue Jan 26 12:05 - 13:52 (01:46) What does the last two fields(12:05 - 13:52 (01:46)) of the output mean? (2 Replies)
Discussion started by: proactiveaditya
2 Replies

10. Red Hat

Understand output of "free" command

Hi Friends, I am really confused with the output of "free" command on redhat linux. I can see caching and buffer output on two different areas on the output. Please let me know whats the difference of these two different outputs. Here I am pasting the command output of my server. # free... (3 Replies)
Discussion started by: arumon
3 Replies
Login or Register to Ask a Question