LinuxQuestions.org
Visit Jeremy's Blog.
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 11-29-2010, 01:33 AM   #1
sattulinux
Member
 
Registered: Sep 2010
Posts: 44

Rep: Reputation: 2
Question command for searching a folder


hi everyone,

I have searched a lot in google regarding the various search commands available for linux, but everywhere i got the commands only for files. But suppose i know the name of a folder but not it's path, then what is the command to search for it's path.

Can anyone please help me regarding this?

with regards,
 
Old 11-29-2010, 01:39 AM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
You use the find command, with the '-type d' option. For example:

Code:
find / -type d -name http
This will search the entire drive (starting at the root, '/') for a directory whose name is 'http'.
 
1 members found this post helpful.
Old 11-29-2010, 02:04 AM   #3
sattulinux
Member
 
Registered: Sep 2010
Posts: 44

Original Poster
Rep: Reputation: 2
Thumbs up

thanks a lot, macemoneta. That has really helped me. Can you send me some links of webpages or pdfs which contain all this commands along with the various options and their corresponding explanations?

Thanking you once again,

With regards,
 
Old 11-29-2010, 02:07 AM   #4
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,674
Blog Entries: 29

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
Quote:
Originally Posted by sattulinux View Post
Can you send me some links of webpages or pdfs which contain all this commands along with the various options and their corresponding explanations?
http://linux.die.net/man/
 
1 members found this post helpful.
Old 11-29-2010, 02:29 AM   #5
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
They are usually installed with every major Linux distribution. Just use the 'man' command, as in:

Code:
man find
If you don't have them installed, you can read them online here.

Last edited by macemoneta; 11-29-2010 at 02:30 AM.
 
1 members found this post helpful.
Old 11-29-2010, 02:43 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
man -k followed by a keyword often helps find the right command. It can be verbose, in which case filtering the output to only show user commands (man section 1) helps. For example:
Code:
c@CW8:~$ man -k search | grep '(1)'
apropos []           (1)  - search the whatis database for strings
bzegrep []           (1)  - search possibly bzip2 compressed files for a regular expression
bzfgrep []           (1)  - search possibly bzip2 compressed files for a regular expression
bzgrep []            (1)  - search possibly bzip2 compressed files for a regular expression
doxytag []           (1)  - generates a tag file and/or a search index for a set of HTML files
find []              (1)  - search for files in a directory hierarchy
git []               (1)  - bisect - Find by binary search the change that introduced a bug
htdig []             (1)  - retrieve HTML documents for ht://Dig search engine
htfuzzy []           (1)  - fuzzy command-line search utility for the ht://Dig search engine
htmerge []           (1)  - create document index and word database for the ht://Dig search engine
htsearch []          (1)  - create document index and word database for the ht://Dig search engine
ldapsearch []        (1)  - LDAP search tool
ldbsearch []         (1)  - Search for records in a LDB database
lkbib []             (1)  - search bibliographic databases
lookbib []           (1)  - search bibliographic databases
lzgrep []            (1)  - search LZMA compressed files for a regular expression
rundig []            (1)  - sample script to create a search database for ht://Dig
whatis []            (1)  - search the whatis database for complete words
zgrep []             (1)  - search possibly compressed files for a regular expression
zipgrep []           (1)  - search files in a ZIP archive for lines matching a pattern
 
1 members found this post helpful.
Old 11-29-2010, 04:44 AM   #7
sattulinux
Member
 
Registered: Sep 2010
Posts: 44

Original Poster
Rep: Reputation: 2
Cool thanks

thanks everyone, for the links sent.

But i get confused while using the 'man' page. No doubt, everything is present there, but i get confused regarding the brackets present, like what should be put in the various brackets mentioned and something like that. A little more precise explanation really helps.
 
Old 11-29-2010, 04:47 AM   #8
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,674
Blog Entries: 29

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
Code:
anisha@linux-uitj:~> man find
Man: find all matching manual pages
 * find (1)
   find (n)
   find (1p)
Man: What manual page do you want?
Man: 1
anisha@linux-uitj:~> man 1 find
anisha@linux-uitj:~>
http://www.mcmcse.com/linux/man_pages.shtml

Last edited by TheIndependentAquarius; 11-29-2010 at 04:50 AM.
 
1 members found this post helpful.
Old 11-29-2010, 07:14 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by sattulinux View Post
But i get confused while using the 'man' page. No doubt, everything is present there, but i get confused regarding the brackets present, like what should be put in the various brackets mentioned and something like that. A little more precise explanation really helps.
The man-pages man page explains in the second SYNOPSIS section: "For commands, this shows the syntax of the command and its arguments (including options); boldface is used for as-is text and italics are used to indicate replaceable arguments. Brackets ([]) surround optional arguments, vertical bars (|) separate choices, and ellipses (...) can be repeated".

Unfortunately bold and italic do not display well in all terminals so at least that part of the standard is not universally implemented but the brackets, vertical bars and ellipses are almost universal so do provide the precision you want. The best man pages describe the options in sufficient detail in the OPTIONS section and include a variety of examples in the EXAMPLES section.

Help on using some commands is also available via info <command> (where the <command> means substitute a specific command!) and sometimes via <command> --help. Help on bash builtin commands is available via help <command>
 
1 members found this post helpful.
Old 11-29-2010, 12:43 PM   #10
naveen143
LQ Newbie
 
Registered: Nov 2010
Posts: 1

Rep: Reputation: 0
hi everyone
how the adminstrator know the cpu is overloaded
what are the precautions that to be taken by the adminstrator
 
0 members found this post helpful.
Old 11-29-2010, 01:03 PM   #11
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,608

Rep: Reputation: 448Reputation: 448Reputation: 448Reputation: 448Reputation: 448
Quote:
Originally Posted by naveen143 View Post
hi everyone
how the adminstrator know the cpu is overloaded
what are the precautions that to be taken by the adminstrator
Do not hijack the thread. Start your own thread instead.
 
  


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
Searching for a folder on entire system rjo98 Linux - Newbie 6 07-17-2009 09:02 AM
Searching for regular expression in command line Jean Of mArc Programming 9 08-11-2008 09:01 PM
A command for searching for a filename Macska Linux - Newbie 1 11-24-2007 01:36 AM
searching text within a folder in linux muby Linux - Newbie 4 10-08-2007 08:45 AM


All times are GMT -5. The time now is 11:24 AM.

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