LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-07-2011, 06:12 AM   #1
sublime188
LQ Newbie
 
Registered: Jan 2011
Posts: 12

Rep: Reputation: 0
Simple Bash cmd Help


Hello everyone,
Yes, I am a noob and I am trying to display a count of the number of subdirectories in a directory.

I have been able to use find -type d to list directories and subdirs but I want a numerical value of dirs and subdirs.

I know ls -l gives a count but when I try ls -l -d all it shows is "." I also have tried a combination with the -R option but nothing seems to be working for me.

Please forgive my ignorance but I am working on a script for class and this is the first step. Any help will be appreciated.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 02-07-2011, 06:29 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

Are you looking for this:
Code:
find . -type d | wc -l
Hope this helps
 
3 members found this post helpful.
Old 02-07-2011, 06:46 AM   #3
sublime188
LQ Newbie
 
Registered: Jan 2011
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks for the quick reply druuna. That was exactly what I was looking for.
 
Old 02-07-2011, 06:49 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
You're welcome
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash/cmd mode: how to know that somebdy is calling in skype ? frenchn00b Programming 1 01-07-2008 04:49 AM
bash shell cmd msg w/dd tschima Linux - Newbie 4 07-12-2007 03:47 AM
Need help or suggestions on drawing a cmd-line GUI in bash. rose_bud4201 Programming 5 02-03-2006 11:35 AM
Simple script to copy files, getting \r's at end of cmd ElricM Linux - Newbie 2 07-23-2005 12:21 PM
simple bash q adam_boz Linux From Scratch 1 06-08-2003 12:22 PM


All times are GMT -5. The time now is 04:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration