Search code examples
regexgrepwildcardls

ls command for specific name convention


I am trying to use the ls command to list specific subdirectories within a directory.

The subdirectories have the following name convention:

abc.wiki.git
abc.git
cde.wiki.git
cde.git
fgh.wiki.git
fgh.git

I would only like to list the subdirectories that do not have "wiki" within the name.


Solution

  • If you want to see everything in said sub-folders you could use:

    ls | grep -v wiki | xargs ls
    

    If you don't want to see inside each subdirectory just use:

    ls | grep -v wiki