ls command help, figures not matching up


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers ls command help, figures not matching up
# 1  
Old 09-12-2006
ls command help, figures not matching up

Hello all.

I ran my AV app. and it scanned 600k+ files on my osx tiger powerpc laptop.
I went into terminal and ran ls -l */* on my applications folder.

for one entry it returned:

Snood3.0/:
total 17376
-rwxrwxrwx 1 ds admin 5152 Jan 17 2006 License30.txt
-rwxrwxrwx 1 ds admin 226101 Jan 17 2006 Snood
-rwxrwxrwx 1 ds admin 15053 Jan 17 2006 Snood 3.0 ReadMe (text).txt
-rwxrwxrwx 1 ds admin 18429 Jan 17 2006 Snood 3.0 ReadMe.rtf
-rw-r--r-- 1 ds admin 352 Jan 18 2006 serial.rtf

I ran ls -l on its parent folder and got this result
drwxrwxrwx 8 ds admin 272 Jan 18 2006 Snood3.0
it shows 8 for the directories. There are 5 files + . & .. = 7 not 8?

1. What constitutes the "8" number if the total "directories" add up to 7?
2. What does the figure "total x" represent, in this case total 17376?
3. As stated above my computer has over 600k files. I'd like to identify which folders/apps contain the most files so I can trim this figure down. Is there a command to list all files of such folder? If in fact the above example includes 17k+ files and I only see 5 I'd like to be able discern the discrepancy between the two.

Thanks for any help
# 2  
Old 09-13-2006
There are two possibilities I can think of offhand.
1. The filesystem for those has problems. see man fsck (or whatever utility anlyzes filesystems for you). Try this first.

2. Since ls returns something different from another "non-standard" utility and ls returns fewer files, consider that your system may have a rootkit installed. This behavior -underreporting files - is a common symptom of that. ls, quota, find, and other binaries - sometimes even kernel modules in Linux - are compromised so as to not show files. Or report the disk space they use.

I'm making guesses here - there is no way to know.

What OS do you have?
# 3  
Old 09-13-2006
It's a Mac (OS X).

Running ls -l and running ls -l */* are 2 different things.
Where did you get the 8? From drwxrwxrwx 8 ? That's not the number of files in the directory.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Expect pattern matching in the command output

This is the command output need to be matched: Telnet console listening to port 42365. (the port number changes every time) Code to test it: ======================================= #!/tools/AGRtools/bin/expect exp_internal 1 set timeout 10 spawn bash set bashId $spawn_id ... (4 Replies)
Discussion started by: marsala
4 Replies

2. Shell Programming and Scripting

UNIX command to get the latest file and also matching pattern

we want to fetch the latest file in a given directory and also the file name should match the below pattern Example file name ->hrdata-2015-10-13-16-45-26.xml(2015-10-13-16-45-26- it is not current timestamp, we just need to check for the pattern) We expect the file will have the... (3 Replies)
Discussion started by: vishwanath001
3 Replies

3. UNIX for Dummies Questions & Answers

find command: names matching the expression

Hello all, I need to print directories using find command. The directories names contain date in the format YYYYMMDD or the name of directory is only the date format. I want print directories, which doesn't start with this date. E.g I have dirs like foo20120101 foo20120101foo 20120101foo... (1 Reply)
Discussion started by: satin1321
1 Replies

4. Shell Programming and Scripting

Significant Figures in awk

Hello, I've had a look at the printf modifiers, but so far I haven't had much luck in making it do what I need. I need to make it output with a set number of characters every time: whether it's by adding zeros at the end or by rounding, the output has to have the same number of characters in it,... (2 Replies)
Discussion started by: Leo_Boon
2 Replies

5. Shell Programming and Scripting

Understanding pattern matching used in a grep command

I have the following code. I want to remove the --sort=num/num/... and am using grep to exclude it as shown below: I have a bit of problem figuring out the use of - at the front echo "--sort=4/5/6" | grep -ivE '-((sort|group)=+/+(/+)*)$' Now suppose I want to remove --quiet I can... (7 Replies)
Discussion started by: kristinu
7 Replies

6. Shell Programming and Scripting

Hex to decimal - Execute command for the matching part

Alo I have this input: 0x10=some text 0x20=some text 0x30=some text and want this output: 16=some text 32=some text 48=some text I want to use a command to convert from hex to decimal i.e.: $ echo $((0x15a)) or $ printf '%d\n' 0x15a I try to use something like this: sed... (5 Replies)
Discussion started by: chitech
5 Replies

7. AIX

Matching command scroll - ksh

In ksh is there a was to scroll thru all matching commands? For example I executed several commands over several days. Is there a way to scroll thru all the matching 'find' commands only that was executed? No messing with the .history file. Anyway to do this from the command prompt? TIA. (3 Replies)
Discussion started by: Un1xNewb1e
3 Replies

8. AIX

matching pattern in 'ps' command

Hi all, I have two instance of jboss (jboss and jboss2). In a shell script that I am writing, I need to grep for each instance of jboss. If i use ps -ef|grep 'jboss', it will also return the process for my second instance of jboss, which is jboss2. Can someone tell me how can i specify the... (1 Reply)
Discussion started by: haroon_a
1 Replies

9. Shell Programming and Scripting

How to from grep command from a file which contains matching words?

Hi all I have a file with below content (content is variable whenever new product is launched). I need form a grep command like this egrep "Unknown product|Invalid symboland so on" How to do it using a script? Unknown product Invalid symbol No ILX exch found exceeds maximum size AFX... (4 Replies)
Discussion started by: johnl
4 Replies

10. Shell Programming and Scripting

Matching a choice of character in test command

Hi ] && exit 0 Although it, the $answer, is 'y', the test operation returns true. && exit 0 This works but I want to do multiple choice matching. I don't want to do like: Please help (2 Replies)
Discussion started by: lalelle
2 Replies
Login or Register to Ask a Question