LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-04-2007, 07:30 AM   #1
thtr2k
Member
 
Registered: Mar 2005
Location: Australia
Posts: 71

Rep: Reputation: 15
please help with command line or script


how do i find a certain directory from commnand line, and count how many of them found. This includes the system directories and the /home/user. Thanks
 
Old 03-04-2007, 07:41 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Use the find command.
If you didn't include your home directory, you could use locate as well, as in:
locate '/lib64/'
However it would show up for each subdirectory and file in '/lib64/', however you can filter that out:
locate '/lib64/' | sed 's#/lib64/.*$#/lib64#' | uniq

While this is more complicated, it is a lot quicker than running find. Especially since you are searching the entire filesystem. It would be better having some idea where things are, as in
find /tmp /home /var -type d -iname '*username*'
 
Old 03-04-2007, 01:03 PM   #3
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Moved: This thread is more suitable in Linux-Software and has been moved accordingly to help your thread/question get the exposure it deserves.
 
  


Reply



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
works on command line but not in bash script tara Linux - General 7 02-09-2009 03:57 AM
Bash Script, no new line for echo command jorisb Linux - General 5 11-05-2005 12:08 AM
auto running a script from command line millionknives Slackware 7 10-03-2005 10:07 PM
How to execute a command line in a shell script orgazmo Programming 5 05-09-2005 09:16 AM
What can I use to resize jpegs via script/command line? davee Linux - Newbie 2 11-03-2003 02:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:42 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
Open Source Consulting | Domain Registration