Announcement

Collapse
No announcement yet.

[SOLVED] Showing only directories with ls

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Showing only directories with ls

    I've been trying to get the ls command to work as advertised. Could it be that the version of ls and the man page are not the same? The man page says:
    -d, --directory
    list directory entries instead of contents, and do not deref‐
    erence symbolic links
    However, "ls -d" only shows the current directory. What do other people do to only show directories?

    #2
    Re: Showing only directories with ls

    I type "ls" because my ~/ only has directories and '.' files in it.

    However, in other directories, I'm seeing the same incorrect behavior that you see.

    Comment


      #3
      Re: Showing only directories with ls

      Originally posted by askrieger
      I type "ls" because my ~/ only has directories and '.' files in it.

      A man after my own heart! I'm not that clean in Linux yet, however I'm downright anal on my DOS machine - the root directory of a very large setup looks like this:
      Code:
      Directory of C:\
      
      PATH   EDC     3,424 11-28-09 11:28a
      SYS     <DIR>     08-30-08  2:44p
      TMP     <DIR>     08-30-08  2:44p
          3 file(s)     3,424 bytes
                 257,323,008 bytes free
      Obviously not a 'windows machine.

      Comment


        #4
        Re: Showing only directories with ls

        Few examples:

        > How can I list directories only in linux?
        > How to: Linux or UNIX List just directories or directory names
        Before you edit, BACKUP !

        Why there are dead links ?
        1. Thread: Please explain how to access old kubuntu forum posts
        2. Thread: Lost Information

        Comment


          #5
          Re: Showing only directories with ls

          Well Rog131, you win! I guess searching the net for an answer is a good idea after all. /blush

          The idea of using grep in various ways is good. To use the ls command as (I guess) intended is pretty straightforward, but who would have guessed from the man page that it was:
          Code:
          ls -d */
          It makes sense now that I see it - especially after having tried
          Code:
          ls */

          Comment

          Working...
          X