LinuxQuestions.org
Help answer threads with 0 replies.
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 01-06-2011, 09:42 PM   #1
fjkum
Member
 
Registered: Feb 2006
Posts: 38

Rep: Reputation: 15
Search for a linux command


Hi,

I would love to see if there is a way in linux that if I have forgotten the command name and would like the search the entire root using "find" command but I am not sure of the case sensative of the command name (eg. VBoxManager or vboxmanager).

So how can I search the root with everything treated as lowercase first? or is there a regular expression to search?
 
Old 01-06-2011, 09:43 PM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,243

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
You mean like using '-iname'? 'i' for ignore case
 
Old 01-07-2011, 06:33 AM   #3
ArfaSmif
Member
 
Registered: Oct 2008
Location: Brisbane Australia
Distribution: Always back to Fedora
Posts: 263

Rep: Reputation: 51
Here's how you can learn to fish - type in "man find" at the command line (no quotes) and you will quickly see what "grail" said. ie.
"-iname" for ignore case.
 
Old 01-07-2011, 07:46 AM   #4
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Quote:
Originally Posted by fjkum View Post
...if there is a way in linux that if I have forgotten the command name and would like the search ...
If you're searching for a Linux-command, i.e. a programname, you may find the apropos command helpful. This command searches the man-database for a keyword. For example
Code:
markus@samsung:~$ apropos search
Class::ISA []        (3)  - - report the search path for a class's ISA tree
FcConfigGetCacheDirs [] (3)  - return the list of directories searched for cache files
Pod::Simple::Search [] (3)  - find POD documents in directory trees
Search::Dict []      (3)  - search for key in dictionary file
Tcl_GetEncodingSearchPath [] (3)  - procedures for creating and using encodings
...
...
...
whatis []            (1)  - search the whatis database for complete words
wmemchr []           (3)  - search a wide character in a wide-character array
zgrep []             (1)  - search possibly compressed files for a regular expression
zipgrep []           (1)  - search files in a ZIP archive for lines matching a pattern
Markus
 
Old 01-07-2011, 12:57 PM   #5
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,052

Rep: Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881
Quote:
Originally Posted by fjkum View Post
Hi,

I would love to see if there is a way in linux that if I have forgotten the command name...
Obviously, completely forgetting the command name makes things harder; if you can even remember a fragment of the command name, that makes things easier. However
Code:
man -k
apropos
(which seem to be synonyms, but 'man -k' seems easier to type) can find by subject, eg, if you want all commands related to 'network' (strictly, featuring the word 'network' in the description)
Code:
man -k network
will get you hits, maybe too many. Of course, you can subsequently filter the results with another term
man -k network | grep -i traffic

Quote:
Originally Posted by fjkum View Post
...but I am not sure of the case sensative of the command name (eg. VBoxManager or vboxmanager).
Well, if you have locate (and updatedb) installed and configured

Code:
locate vboxmanager
should do it for you. It is faster than searching all of the filesystem, from '/' downwards, with find. Find is, of course, more powerful than locate, but it can be fiddly to use and is slower.

Of course, if you know where commands are stored on your system, you might just want to search those places. Some commands will be intended for the root users use, and they are likely to be in other places (check root's path versus that for an ordinary user), but, if you think a command is likely to be in /usr/sbin (as an example)

locate /usr/sbin | grep -i commandname

(or 'commandnamefragment') might be something you'd like to try.
 
  


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
LXer: Search Google.com from the Linux command line LXer Syndicated Linux News 0 08-08-2009 09:31 PM
giving search-string(s) from a file to linux "find" command Fond_of_Opensource Linux - Newbie 3 02-02-2009 07:14 PM
search command? IonMarais Linux - Newbie 7 10-13-2006 07:59 AM
command to search ekdya Linux - Newbie 3 11-12-2005 10:46 AM


All times are GMT -5. The time now is 11:00 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