Results 1 to 3 of 3

Thread: What is the command

  1. #1
    Contributing Member
    Join Date
    Jul 2006

    What is the command

    What is the command that I can use in Linux to list the directory name alone. Could someone help me out in this?

  2. #2
    Contributing Member
    Join Date
    Jul 2006

    Re: What is the command

    You can use the option –d or the directory command line option with the ls command. Suppose you want to list the directory names alone starting with a in directory /usr/x you can do that as follows:
    ls –d /use/x/a*

  3. #3
    Expert Member
    Join Date
    Mar 2012

    Re: What is the command

    In linux there is no direct way of listing directories,hence we combine the ls command with grep and type as follows:

    1. use ls -l with grep
    2. use find -type d

    Example: -l | grep "^d" -The simple way to list just directories, is using ls -l pipe with grep
    2.find -L -maxdepth 1 -type d -name
    here -L is to show also for the symbolic link to directory, -maxdepth limit the search up to only 1 level, -type d indicates that the file must be directory.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.