Find the answer to your Linux question:
Results 1 to 4 of 4
Inside /proc/ folder, this Code: ls -l | cut -d' ' -f35 | grep ^1$ #35th field is folder names finds folder "1" (init). Is there a better way to ...
  1. #1
    Just Joined!
    Join Date
    Dec 2010
    Posts
    15

    Angry [SOLVED] cut from ls -l

    Inside /proc/ folder, this
    Code:
    ls -l | cut -d' ' -f35 | grep ^1$  #35th field is folder names
    finds folder "1" (init).

    Is there a better way to find folder names (rather than "cut" 35th (!) field)?
    Code:
    cut -d' ' -f35
    Last edited by courteous; 12-12-2010 at 12:02 PM.

  2. #2
    Just Joined!
    Join Date
    Jul 2010
    Posts
    26
    I think that all the folders in /proc/ have the permissions :

    Code:
     dr-xr-xr-x
    so you can get the folder names by :

    Code:
    ls -l /proc/ | grep -e "dr-xr-xr-x" | cut -d: -f2 | cut -d' ' -f2
    Last edited by Barakat; 12-12-2010 at 04:09 PM.

  3. #3
    Linux User Manko10's Avatar
    Join Date
    Sep 2010
    Posts
    250
    What about find /proc -type d -maxdepth 1?
    Refining Linux Advent calendar: “24 Outstanding ZSH Gems

  4. #4
    Just Joined!
    Join Date
    Dec 2010
    Posts
    15
    Thank you both Barakat and Manko!

Posting Permissions

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