SlackwareThis Forum is for the discussion of Slackware Linux.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Being at a certain directory I want to list the names of all subdirs under this dir. I have found this can be done with 'find . -type d -maxdepth 1'. Question: can this be done with the ls command? Regards.
Well, thank you very much. I can see how bash expands * or */ by issuing 'ls */'. Adding the -d option prevents ls from entering the child directories. But given that in 'ls *' * expands in the same way, I can't see where is the difference. Anyways, the command works, and that's fine with me.
Yes. Many times, when I wanted to see the file mode bits of a directory, I was forced to use the -d option. For example, with 'ls -l samples/' I only could see the contents of ./samples. But if I did 'ls -ld samples' then I could see the file mode bits of directory ./samples. The grep trick I also had used it, but I did not like to depend on the graphical output of the listings. The 'find' solution seemed good to me but if I could do it with 'ls' I would have more control over the listing format and information.
In M$-DOS it is very simple: DIR/AD. That's all. Of course, it isn't as powerful as ls is. Well, this is commentary, nothing else. Thanks to you both and regards.
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Yes - to be honest I have often used "find -d" to show directories somewhere not knowing of Chuck56's clever solution - either using find or just paging through a ls directory listing looking for directories - Chuck56's method is really cool. One for me to store in my "linux tricks" book I think. Thanks again Chuck56.