I have lots subdirectories containing data, and I want a short list of which jobs (subdirectories) I have. I'm not happy with the following command.
$ ls H2* H2a: energy.dat overlap.dat norm.dat zdip.dat ... (much more) H2b: energy.dat overlap.dat norm.dat zdip.dat ... (much more)
This needless clutter defeats the purpose of the wildcard (limiting the output). How can I limit the output to one level deep? I'd like to see the following output
H2a/ H2b/ H2z/
Thanks for your help, Nick
Try this
ls -d H2*/
The -d
option is supposed to list "directories only", but by itself just lists
.
which I personally find kind of strange. The wildcard is needed to get an actual list of directories.
UPDATE: As @Philipp points out, you can do this even more concisely and without leaving bash by saying
echo H2*/
The difference is that ls
will print the items on separate lines, which is often useful for piping to other functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With