Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    ls command --> capturing data

    Is there a method in which I can list all the directories under root to a text file ?
    I've tried ls -R but cannot tie this in the -d to show me just the directories...


  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Täby, Sweden
    -d doesn't make ls only list directories. It makes ls list directory names found on the command line instead of recursing into them.
    I'm not sure exactly what you want to do, but I'm guessing that what you want is this:
    [code]find / -type d -maxdepth 2 >file{/code]

  3. #3

    Thank you...

    Once again LinuxForums to the rescue.....
    feel slightly piss*ff though - I would never have known that.......

    thanks for your help....

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts