LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-09-2013, 02:18 PM   #1
Siaw
LQ Newbie
 
Registered: Mar 2013
Posts: 6

Rep: Reputation: Disabled
the "whereis" LINUX command


i don't understand the whereis command in the linux terminal. it's used to find files. i search the internet and what they showed me is not comprehensible. how do i use the "whereis" command? please.
 
Old 03-09-2013, 02:24 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,332
Blog Entries: 55

Rep: Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533
Code:
# Only locations:
 ~]$ which ls
        /bin/ls

# Only manual pages:
 ~]$ whatis ls
ls                   (1)  - list directory contents
ls                   (1p)  - list directory contents

# The answer to life, the universe and everything:
 ~]$ whereis ls
ls: /bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz
 
Old 03-09-2013, 02:51 PM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
It's manual has all answers, just go through it (see here)

Take a note, whereis won't search for files, but whereis locates source/binary and manuals sections for specified files.

Code:
~$ whereis ls
ls: /bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz
But if you will search for a simple file, it will return nothing, execpt filename itself:
Code:
~$ whereis foo
foo:
 
1 members found this post helpful.
Old 03-09-2013, 03:07 PM   #4
Siaw
LQ Newbie
 
Registered: Mar 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
thanks you very much
 
Old 03-12-2013, 10:40 AM   #5
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958
To locate regular files by name or pattern, you should generally use the locate command (imagine that ).

Be aware, however, that locate works by reading a previously-indexed snapshot of your system tree, created by the updatedb program. If changes have been made since the database was last refreshed you can get inaccurate results. Most distributions set up an automatic cronjob to run updatedb for you, usually once a day.

For truly up-to-date results, you need to use find instead:

http://mywiki.wooledge.org/UsingFind
http://www.grymoire.com/Unix/Find.html
 
1 members found this post helpful.
  


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
Centos Server Failed @ Bootup: Missing "/sbin/blkid" & "fsck" command not found beagle7 Linux - Newbie 4 08-24-2012 02:33 AM
[SOLVED] Errors executing shell script: "command not found" and "no such file or directory" eko000 Linux - Newbie 1 01-14-2011 08:54 AM
ns:"error when calling class OldSim"&tclsh:"invalid command+child process exits abn." shojaru Linux - Newbie 0 03-05-2009 05:23 AM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 11:18 PM
"which" and "whereis" question graziano1968 Linux - General 3 06-04-2007 02:45 PM


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