LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to get a file listing including subdirs, with sizes plus fully-qualified names (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-get-a-file-listing-including-subdirs-with-sizes-plus-fully-qualified-names-947801/)

anadem 05-31-2012 11:52 AM

how to get a file listing including subdirs, with sizes plus fully-qualified names
 
find can give me a list of fully-qualified names, but doesn't provide size info
ls can give me a list of file sizes, but the names are not FQN
how can i get a list that has both size and fully-qualified names of all files including those in subdirectories?

E.g. something like this (though I don't need any info except name and size; permissions, owner, etc are not essential & can be cut later):

Code:

-r--r--r--  1 root root  21K May 31 01:35 ./current/apache/httpd.conf
-rw-r--r--  1 root root 1.5K May 31 01:35 ./current/apache/server.crt
-rw-r--r--  1 root root  887 May 31 01:35 ./current/apache/server.key
-rw-r--r--  1 root root  237 May 31 01:35 ./current/apache/httpd.virtualhost.conf
-rw-r--r--  1 root root  78K May 31 01:35 ./current/etc/mibs/RFC1213-MIB.txt
-rw-r--r--  1 root root  61K May 31 01:35 ./current/etc/mibs/APPACCELERATION-STATUS-MIB.txt
-rw-r--r--  1 root root  39K May 31 01:35 ./current/etc/mibs/SNMP-USER-BASED-SM-MIB.txt
-rw-r--r--  1 root root  38K May 31 01:35 ./current/etc/mibs/SNMPv2-TC.txt

thanks!

xjonquilx 05-31-2012 12:00 PM

The command you're looking for is ls -l.


[root@jonquil ~]# ls -l
total 16
-rw-------. 1 root root 923 May 30 17:56 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 May 30 19:49 Desktop
-rw-rw-r--. 1 root root 5283 May 29 20:20 el_dlurls.txt

---------- Post added 05-31-12 at 01:01 PM ----------

Also if you want to list hidden files add an a to that.


[root@jonquil ~]# ls -la
total 80
dr-xr-x---. 10 root root 4096 May 31 11:07 .
dr-xr-xr-x. 19 root root 4096 May 31 10:45 ..
-rw-------. 1 root root 923 May 30 17:56 anaconda-ks.cfg
-rw-------. 1 root root 442 May 31 07:37 .bash_history
-rw-r--r--. 1 root root 18 Jan 14 16:25 .bash_logout
-rw-r--r--. 1 root root 176 Jan 14 16:25 .bash_profile
-rw-r--r--. 1 root root 176 Jan 14 16:25 .bashrc
drwx------. 3 root root 4096 May 30 17:57 .cache
drwx------. 4 root root 4096 May 30 19:49 .config
-rw-r--r--. 1 root root 100 Jan 14 16:25 .cshrc
drwx------. 3 root root 4096 May 30 17:57 .dbus
drwxr-xr-x. 2 root root 4096 May 30 19:49 Desktop
-rw-rw-r--. 1 root root 5283 May 29 20:20 el_dlurls.txt
drwxr-xr-x. 3 root root 4096 May 30 19:49 .gnome2
drwxr-xr-x. 3 root root 4096 May 30 21:20 .local
drwxr-----. 3 root root 4096 May 30 18:00 .pki
-rw-r--r--. 1 root root 129 Jan 14 16:25 .tcshrc
drwx------. 3 root root 4096 May 30 19:49 .thumbnails
-rw-------. 1 root root 52 May 31 11:07 .xauthQD4jER

I don't know how to show the full directory listing, though.

grail 05-31-2012 12:21 PM

How about:
Code:

find /path/to/start -printf "%p %s\n"

anadem 05-31-2012 12:49 PM

Quote:

Originally Posted by grail (Post 4692180)
How about:
Code:

find /path/to/start -printf "%p %s\n"

Perfect, many thanks! (I did man find but didn't see %p %s)


All times are GMT -5. The time now is 12:20 AM.