Using ls in Linux to show directories onlyAbout “ls” , how can I just show directories only (except linked directories and hidden directories)Remove a symlink to a directoryHow do I prompt for Yes/No/Cancel input in a Linux shell script?How to symlink a file in Linux?How do I change permissions for a folder and all of its subfolders and files in one step in Linux?How to exclude a directory in find . commandHow to change the output color of echo in LinuxHow can I use grep to show just filenames on Linux?Recursively counting files in a Linux directoryListing only directories using ls in bash: An examinationHow do I find all files containing specific text on Linux?

Unbiased estimator of exponential of measure of a set?

To "hit home" in German

Are there reliable, formulaic ways to form chords on the guitar?

Does Denmark lose almost $700 million a year "carrying" Greenland?

Earliest evidence of objects intended for future archaeologists?

Why doesn't the Falcon-9 first stage use three legs to land?

Alchemist potion on Undead

Why would the President need briefings on UFOs?

Nuclear decay triggers

Chord with lyrics - What does it mean if there is an empty space instead of a Chord?

90s(?) book series about two people transported to a parallel medieval world, she joins city watch, he becomes wizard

Sort, slice and rebuild new object with array data

What can I do to keep a threaded bolt from falling out of it’s slot

Are there any OR challenges that are similar to kaggle's competitions?

Why does my air conditioner still run, even when it is cooler outside than in?

Why do some academic journals requires a separate "summary" paragraph in addition to an abstract?

Why don't sharp and flat root note chords seem to be present in much guitar music?

Can others monetize my project with GPLv3?

How to think about joining a company whose business I do not understand?

How does the Saturn V Dynamic Test Stand work?

Don't teach Dhamma to those who can't appreciate it or aren't interested

Writing/buying Seforim rather than Sefer Torah

Chess software to analyze games

Designing a prison for a telekinetic race



Using ls in Linux to show directories only


About “ls” , how can I just show directories only (except linked directories and hidden directories)Remove a symlink to a directoryHow do I prompt for Yes/No/Cancel input in a Linux shell script?How to symlink a file in Linux?How do I change permissions for a folder and all of its subfolders and files in one step in Linux?How to exclude a directory in find . commandHow to change the output color of echo in LinuxHow can I use grep to show just filenames on Linux?Recursively counting files in a Linux directoryListing only directories using ls in bash: An examinationHow do I find all files containing specific text on Linux?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I'm getting myself familiar with Linux (Debian 9). However I managed to get myself confused with the ls command manual. I made up the following trivial setting for testing:



meouser:~/triv_dir$ ls -laR
.:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 .
drwxr-xr-x 19 meouser meouser 4096 Mar 27 15:41 ..
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 a
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:42 b
-rw-r--r-- 1 meouser meouser 6 Mar 27 15:44 c
-rw-r--r-- 1 meouser meouser 6 Mar 27 15:44 d

./a:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 ..
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 aa
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 ab
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_1
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_2

./a/a_sub_1:
total 12
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 ..
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:55 aaa

./a/a_sub_2:
total 8
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 ..

./b:
total 16
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:42 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 ..
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 ba
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 bb


I would like to see all the directory names and their subdirectories, but not the filenames. That is, I want something like ls --insert-options-here so that the output is this subset from above:



.:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 .
drwxr-xr-x 19 meouser meouser 4096 Mar 27 15:41 ..
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 a
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:42 b

./a:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 ..
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_1
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_2


According to ls manual that should be achieved by ls -ldR.



meouser:~/triv_dir$ man ls

-a, --all
do not ignore entries starting with .

-d, --directory
list directories themselves, not their contents

-l use a long listing format

-R, --recursive
list subdirectories recursively


But this is what happens instead: only the '.' is shown.



meouser:~/triv_dir$ ls -ldR
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 .


What am I missing from the manual?



I noticed from https://stackoverflow.com/a/29277454/11199684 that this can be achieved by
find . -maxdepth 2 -type d -print
which is impressive but it gives less information than the ls output above. Besides, I might not know beforehand the correct maxdepth? And above all, for future needs I'm actually interested in teaching myself from the manuals. Advice are appreciated.










share|improve this question
























  • If you use zsh, you can do ls -ld **/*(/) Not sure if possible with plain ls

    – balki
    Mar 27 at 15:00











  • @balki I seem to have bash. That gives error message bash: syntax error near unexpected token `(' . zsh is unrecognized command.

    – user9393931
    Mar 27 at 15:28












  • Yes, it does not work in bash. If possible, install zsh (sudo apt install zsh). it is a better shell than bash and mostly backwards compatible with bash.

    – balki
    Mar 27 at 15:32

















1















I'm getting myself familiar with Linux (Debian 9). However I managed to get myself confused with the ls command manual. I made up the following trivial setting for testing:



meouser:~/triv_dir$ ls -laR
.:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 .
drwxr-xr-x 19 meouser meouser 4096 Mar 27 15:41 ..
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 a
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:42 b
-rw-r--r-- 1 meouser meouser 6 Mar 27 15:44 c
-rw-r--r-- 1 meouser meouser 6 Mar 27 15:44 d

./a:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 ..
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 aa
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 ab
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_1
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_2

./a/a_sub_1:
total 12
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 ..
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:55 aaa

./a/a_sub_2:
total 8
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 ..

./b:
total 16
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:42 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 ..
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 ba
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 bb


I would like to see all the directory names and their subdirectories, but not the filenames. That is, I want something like ls --insert-options-here so that the output is this subset from above:



.:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 .
drwxr-xr-x 19 meouser meouser 4096 Mar 27 15:41 ..
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 a
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:42 b

./a:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 ..
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_1
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_2


According to ls manual that should be achieved by ls -ldR.



meouser:~/triv_dir$ man ls

-a, --all
do not ignore entries starting with .

-d, --directory
list directories themselves, not their contents

-l use a long listing format

-R, --recursive
list subdirectories recursively


But this is what happens instead: only the '.' is shown.



meouser:~/triv_dir$ ls -ldR
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 .


What am I missing from the manual?



I noticed from https://stackoverflow.com/a/29277454/11199684 that this can be achieved by
find . -maxdepth 2 -type d -print
which is impressive but it gives less information than the ls output above. Besides, I might not know beforehand the correct maxdepth? And above all, for future needs I'm actually interested in teaching myself from the manuals. Advice are appreciated.










share|improve this question
























  • If you use zsh, you can do ls -ld **/*(/) Not sure if possible with plain ls

    – balki
    Mar 27 at 15:00











  • @balki I seem to have bash. That gives error message bash: syntax error near unexpected token `(' . zsh is unrecognized command.

    – user9393931
    Mar 27 at 15:28












  • Yes, it does not work in bash. If possible, install zsh (sudo apt install zsh). it is a better shell than bash and mostly backwards compatible with bash.

    – balki
    Mar 27 at 15:32













1












1








1








I'm getting myself familiar with Linux (Debian 9). However I managed to get myself confused with the ls command manual. I made up the following trivial setting for testing:



meouser:~/triv_dir$ ls -laR
.:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 .
drwxr-xr-x 19 meouser meouser 4096 Mar 27 15:41 ..
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 a
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:42 b
-rw-r--r-- 1 meouser meouser 6 Mar 27 15:44 c
-rw-r--r-- 1 meouser meouser 6 Mar 27 15:44 d

./a:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 ..
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 aa
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 ab
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_1
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_2

./a/a_sub_1:
total 12
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 ..
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:55 aaa

./a/a_sub_2:
total 8
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 ..

./b:
total 16
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:42 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 ..
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 ba
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 bb


I would like to see all the directory names and their subdirectories, but not the filenames. That is, I want something like ls --insert-options-here so that the output is this subset from above:



.:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 .
drwxr-xr-x 19 meouser meouser 4096 Mar 27 15:41 ..
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 a
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:42 b

./a:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 ..
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_1
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_2


According to ls manual that should be achieved by ls -ldR.



meouser:~/triv_dir$ man ls

-a, --all
do not ignore entries starting with .

-d, --directory
list directories themselves, not their contents

-l use a long listing format

-R, --recursive
list subdirectories recursively


But this is what happens instead: only the '.' is shown.



meouser:~/triv_dir$ ls -ldR
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 .


What am I missing from the manual?



I noticed from https://stackoverflow.com/a/29277454/11199684 that this can be achieved by
find . -maxdepth 2 -type d -print
which is impressive but it gives less information than the ls output above. Besides, I might not know beforehand the correct maxdepth? And above all, for future needs I'm actually interested in teaching myself from the manuals. Advice are appreciated.










share|improve this question














I'm getting myself familiar with Linux (Debian 9). However I managed to get myself confused with the ls command manual. I made up the following trivial setting for testing:



meouser:~/triv_dir$ ls -laR
.:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 .
drwxr-xr-x 19 meouser meouser 4096 Mar 27 15:41 ..
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 a
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:42 b
-rw-r--r-- 1 meouser meouser 6 Mar 27 15:44 c
-rw-r--r-- 1 meouser meouser 6 Mar 27 15:44 d

./a:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 ..
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 aa
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 ab
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_1
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_2

./a/a_sub_1:
total 12
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 ..
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:55 aaa

./a/a_sub_2:
total 8
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 ..

./b:
total 16
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:42 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 ..
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 ba
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 bb


I would like to see all the directory names and their subdirectories, but not the filenames. That is, I want something like ls --insert-options-here so that the output is this subset from above:



.:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 .
drwxr-xr-x 19 meouser meouser 4096 Mar 27 15:41 ..
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 a
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:42 b

./a:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 ..
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_1
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_2


According to ls manual that should be achieved by ls -ldR.



meouser:~/triv_dir$ man ls

-a, --all
do not ignore entries starting with .

-d, --directory
list directories themselves, not their contents

-l use a long listing format

-R, --recursive
list subdirectories recursively


But this is what happens instead: only the '.' is shown.



meouser:~/triv_dir$ ls -ldR
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 .


What am I missing from the manual?



I noticed from https://stackoverflow.com/a/29277454/11199684 that this can be achieved by
find . -maxdepth 2 -type d -print
which is impressive but it gives less information than the ls output above. Besides, I might not know beforehand the correct maxdepth? And above all, for future needs I'm actually interested in teaching myself from the manuals. Advice are appreciated.







linux ls manual






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 14:50









user9393931user9393931

63 bronze badges




63 bronze badges















  • If you use zsh, you can do ls -ld **/*(/) Not sure if possible with plain ls

    – balki
    Mar 27 at 15:00











  • @balki I seem to have bash. That gives error message bash: syntax error near unexpected token `(' . zsh is unrecognized command.

    – user9393931
    Mar 27 at 15:28












  • Yes, it does not work in bash. If possible, install zsh (sudo apt install zsh). it is a better shell than bash and mostly backwards compatible with bash.

    – balki
    Mar 27 at 15:32

















  • If you use zsh, you can do ls -ld **/*(/) Not sure if possible with plain ls

    – balki
    Mar 27 at 15:00











  • @balki I seem to have bash. That gives error message bash: syntax error near unexpected token `(' . zsh is unrecognized command.

    – user9393931
    Mar 27 at 15:28












  • Yes, it does not work in bash. If possible, install zsh (sudo apt install zsh). it is a better shell than bash and mostly backwards compatible with bash.

    – balki
    Mar 27 at 15:32
















If you use zsh, you can do ls -ld **/*(/) Not sure if possible with plain ls

– balki
Mar 27 at 15:00





If you use zsh, you can do ls -ld **/*(/) Not sure if possible with plain ls

– balki
Mar 27 at 15:00













@balki I seem to have bash. That gives error message bash: syntax error near unexpected token `(' . zsh is unrecognized command.

– user9393931
Mar 27 at 15:28






@balki I seem to have bash. That gives error message bash: syntax error near unexpected token `(' . zsh is unrecognized command.

– user9393931
Mar 27 at 15:28














Yes, it does not work in bash. If possible, install zsh (sudo apt install zsh). it is a better shell than bash and mostly backwards compatible with bash.

– balki
Mar 27 at 15:32





Yes, it does not work in bash. If possible, install zsh (sudo apt install zsh). it is a better shell than bash and mostly backwards compatible with bash.

– balki
Mar 27 at 15:32












1 Answer
1






active

oldest

votes


















2














The -d option apply to [FILE] given as input, in your case, as none are given, you fall back to the default one : the current directory. The recursivity doesn't apply as no directory are returned.



To get the same output as ls with the find command, you can combine them :



find . -type d -exec ls -ld ;





share|improve this answer



























  • Thanks for that solution, it is an interesting one and will take me some time to digest that syntax. But I don't quite get your first paragraph. With ls -ldR . there is input (the current directory) but I still get the same result as with ls -ldR (only .). And with ls -ldR * I get the same result as with ls -l (list of a,b,c,d).

    – user9393931
    Mar 27 at 15:41











  • I tried to explain why the manual says "list directories themselves". Another way to say it is "list directories themselves given as input". You can think of the -d option having the precedence over the -R one (if you don't list the content, how can the recursivity works ?).

    – Jona
    Mar 27 at 15:56












  • @jww Do you mean that this question is more appropriate on unix.stackexchange.com ?

    – Jona
    Mar 27 at 20:22










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55380172%2fusing-ls-in-linux-to-show-directories-only%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














The -d option apply to [FILE] given as input, in your case, as none are given, you fall back to the default one : the current directory. The recursivity doesn't apply as no directory are returned.



To get the same output as ls with the find command, you can combine them :



find . -type d -exec ls -ld ;





share|improve this answer



























  • Thanks for that solution, it is an interesting one and will take me some time to digest that syntax. But I don't quite get your first paragraph. With ls -ldR . there is input (the current directory) but I still get the same result as with ls -ldR (only .). And with ls -ldR * I get the same result as with ls -l (list of a,b,c,d).

    – user9393931
    Mar 27 at 15:41











  • I tried to explain why the manual says "list directories themselves". Another way to say it is "list directories themselves given as input". You can think of the -d option having the precedence over the -R one (if you don't list the content, how can the recursivity works ?).

    – Jona
    Mar 27 at 15:56












  • @jww Do you mean that this question is more appropriate on unix.stackexchange.com ?

    – Jona
    Mar 27 at 20:22















2














The -d option apply to [FILE] given as input, in your case, as none are given, you fall back to the default one : the current directory. The recursivity doesn't apply as no directory are returned.



To get the same output as ls with the find command, you can combine them :



find . -type d -exec ls -ld ;





share|improve this answer



























  • Thanks for that solution, it is an interesting one and will take me some time to digest that syntax. But I don't quite get your first paragraph. With ls -ldR . there is input (the current directory) but I still get the same result as with ls -ldR (only .). And with ls -ldR * I get the same result as with ls -l (list of a,b,c,d).

    – user9393931
    Mar 27 at 15:41











  • I tried to explain why the manual says "list directories themselves". Another way to say it is "list directories themselves given as input". You can think of the -d option having the precedence over the -R one (if you don't list the content, how can the recursivity works ?).

    – Jona
    Mar 27 at 15:56












  • @jww Do you mean that this question is more appropriate on unix.stackexchange.com ?

    – Jona
    Mar 27 at 20:22













2












2








2







The -d option apply to [FILE] given as input, in your case, as none are given, you fall back to the default one : the current directory. The recursivity doesn't apply as no directory are returned.



To get the same output as ls with the find command, you can combine them :



find . -type d -exec ls -ld ;





share|improve this answer















The -d option apply to [FILE] given as input, in your case, as none are given, you fall back to the default one : the current directory. The recursivity doesn't apply as no directory are returned.



To get the same output as ls with the find command, you can combine them :



find . -type d -exec ls -ld ;






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 27 at 15:04

























answered Mar 27 at 14:58









JonaJona

4041 gold badge3 silver badges11 bronze badges




4041 gold badge3 silver badges11 bronze badges















  • Thanks for that solution, it is an interesting one and will take me some time to digest that syntax. But I don't quite get your first paragraph. With ls -ldR . there is input (the current directory) but I still get the same result as with ls -ldR (only .). And with ls -ldR * I get the same result as with ls -l (list of a,b,c,d).

    – user9393931
    Mar 27 at 15:41











  • I tried to explain why the manual says "list directories themselves". Another way to say it is "list directories themselves given as input". You can think of the -d option having the precedence over the -R one (if you don't list the content, how can the recursivity works ?).

    – Jona
    Mar 27 at 15:56












  • @jww Do you mean that this question is more appropriate on unix.stackexchange.com ?

    – Jona
    Mar 27 at 20:22

















  • Thanks for that solution, it is an interesting one and will take me some time to digest that syntax. But I don't quite get your first paragraph. With ls -ldR . there is input (the current directory) but I still get the same result as with ls -ldR (only .). And with ls -ldR * I get the same result as with ls -l (list of a,b,c,d).

    – user9393931
    Mar 27 at 15:41











  • I tried to explain why the manual says "list directories themselves". Another way to say it is "list directories themselves given as input". You can think of the -d option having the precedence over the -R one (if you don't list the content, how can the recursivity works ?).

    – Jona
    Mar 27 at 15:56












  • @jww Do you mean that this question is more appropriate on unix.stackexchange.com ?

    – Jona
    Mar 27 at 20:22
















Thanks for that solution, it is an interesting one and will take me some time to digest that syntax. But I don't quite get your first paragraph. With ls -ldR . there is input (the current directory) but I still get the same result as with ls -ldR (only .). And with ls -ldR * I get the same result as with ls -l (list of a,b,c,d).

– user9393931
Mar 27 at 15:41





Thanks for that solution, it is an interesting one and will take me some time to digest that syntax. But I don't quite get your first paragraph. With ls -ldR . there is input (the current directory) but I still get the same result as with ls -ldR (only .). And with ls -ldR * I get the same result as with ls -l (list of a,b,c,d).

– user9393931
Mar 27 at 15:41













I tried to explain why the manual says "list directories themselves". Another way to say it is "list directories themselves given as input". You can think of the -d option having the precedence over the -R one (if you don't list the content, how can the recursivity works ?).

– Jona
Mar 27 at 15:56






I tried to explain why the manual says "list directories themselves". Another way to say it is "list directories themselves given as input". You can think of the -d option having the precedence over the -R one (if you don't list the content, how can the recursivity works ?).

– Jona
Mar 27 at 15:56














@jww Do you mean that this question is more appropriate on unix.stackexchange.com ?

– Jona
Mar 27 at 20:22





@jww Do you mean that this question is more appropriate on unix.stackexchange.com ?

– Jona
Mar 27 at 20:22








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55380172%2fusing-ls-in-linux-to-show-directories-only%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript