Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

i want to search qdbase (the name of DB). i dont know where this file is lies.i want to use grep at my server. my server name is qa@qaubuntu and for root root@qaubuntu.. i'm searching this file using terminal from client PC(qa@qadesktop)

share|improve this question

2 Answers 2

up vote 2 down vote accepted

So you're looking for a file with a known name and unknown location?

Two options:

  1. locate qdbase
  2. sudo find / -name qdbase -print

The latter is probably slower, but more "thorough", the first command is based on the fact that all file names have been indexed already, so that the search is quicker. Try the first option and if it fails, the second one.

You'll probably have to rsh in first. grep is used to find data inside a file, so it's probably not what you want here. The sudo part is needed for permission reasons.

share|improve this answer
sudo grep / "String to search for"

sudo to not restrict the search by what folders your regular user is allowed access to

grep to search

/ for the root of the drive

"String to search for"

share|improve this answer
    
"qa@qaubuntu:~$ sudo grep /qdbase" like this? –  klox Jul 20 '10 at 4:45
    
sudo grep / "qdbase" –  EricR Jul 20 '10 at 4:53
    
this grep command does not work: it's grep [options] regexp file [file] where regexp is a regular expression, which can be a string, but can need escaped characters etc. So it's not quite that simple. –  Henno Jul 20 '10 at 4:54
    
that's for finding text in files, if you're looking for a name, I use cd / && find -iname "qdbase" –  EricR Jul 20 '10 at 4:56
2  
the fact remains that you give / as a first argument (which is the string to search) and a location (file, or directory if you use the -r option), the second argument, named "string to search for". So the order is wrong. If you do sudo grep -r -l 'string to search for' / (which will take a very long time, presumably) you will get a list of all files that contain that string... –  Henno Jul 20 '10 at 5:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.