Prev: commenting all lines with a particular substring
Next: [announcement] runawk-0.21.0 -- yet another power tool to program in shell
From: Chris F.A. Johnson on 31 Mar 2010 12:18 On 2010-03-31, aioe wrote: > On 3/31/2010 9:43 AM, Bill Marcum wrote: > >> If you want to see directory permissions and timestamps, with GNU find you >> can use "find . -type d -ls". Or you can type "ls -ld */ " but that will >> only show directories within the current directory. > > Usually I simply want to see the directory structure. du is the > shortest command to type, but it is slow if there are a lot of files. > find -type d is fast and does the job, but ls -dR would be easier to > type, if only it worked as I would expect. This has bothered me for > years, so I thought to ask. To see the directory structure, I like the 'tree' command. It's not standard, but it is readily available. -- Chris F.A. Johnson, author <http://shell.cfajohnson.com/> =================================================================== Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) ===== My code in this post, if any, assumes the POSIX locale ===== ===== and is released under the GNU General Public Licence =====
From: pk on 31 Mar 2010 12:48 aioe wrote: > On 3/31/2010 7:56 AM, pk wrote: > >> So, "ls -l directory" shows the files in the directory; "ls -ld >> directory" shows the properties of the directory itself. > > For that, I just invoke ls -l from one level higher in the directory > tree, Well, except for the root directory itself I guess! :)
From: Janis Papanagnou on 31 Mar 2010 14:43 aioe schrieb: > On 3/31/2010 9:43 AM, Bill Marcum wrote: > >> If you want to see directory permissions and timestamps, with GNU find >> you >> can use "find . -type d -ls". Or you can type "ls -ld */ " but that will >> only show directories within the current directory. > > Usually I simply want to see the directory structure. du is the > shortest command to type, but it is slow if there are a lot of files. > find -type d is fast and does the job, but ls -dR would be easier to > type, if only it worked as I would expect. This has bothered me for > years, so I thought to ask. If it's only typing convenience for a specific job you often do, then use an alias or a function definition for that command in your profile. Janis
From: Keith Keller on 31 Mar 2010 14:58 On 2010-03-31, aioe <worKEEPSPAMOUTwor(a)bellsouth.net> wrote: > On 3/31/2010 7:56 AM, pk wrote: > >> So, "ls -l directory" shows the files in the directory; "ls -ld directory" >> shows the properties of the directory itself. > > For that, I just invoke ls -l from one level higher in the directory > tree, but I suppose -d might be useful in scripts. If the parent directory of "directory" contains a large number of files an ls -l from there will be difficult to read. You can pipe it through grep, but at that point you may as well just use ls -ld. --keith -- kkeller-usenet(a)wombat.san-francisco.ca.us (try just my userid to email me) AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt see X- headers for PGP signature information
From: Barry Margolin on 31 Mar 2010 21:06
In article <hovr5a$dqk$1(a)speranza.aioe.org>, aioe <worKEEPSPAMOUTwor(a)bellsouth.net> wrote: > On 3/31/2010 7:56 AM, pk wrote: > > > So, "ls -l directory" shows the files in the directory; "ls -ld directory" > > shows the properties of the directory itself. > > For that, I just invoke ls -l from one level higher in the directory > tree, but I suppose -d might be useful in scripts. If you do that, it shows all the other files and directories in the parent directory. How do you do it if you just want to list the properties of that one directory? "ls -l | grep foo"? -- Barry Margolin, barmar(a)alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group *** |