LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 06-15-2011, 07:17 AM   #1
hitmen
Member
 
Registered: Jun 2011
Distribution: Kubuntu 10.04
Posts: 158

Rep: Reputation: Disabled
Hello World Script Not Detected Using locate and whereis


As above.

I read somewhere that shell scripts are not detected because they may be system files.

So how do I detect them.

Noob as I am just doing my hello world program.

Also what is the difference between "ls bin" and "ls /bin"

Last edited by hitmen; 06-15-2011 at 07:35 AM.
 
Old 06-15-2011, 07:19 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
Not sure what you're referring to, but that's not true at all. all real files will be indexed by locate. Whereis is a different tool though which searches your $PATH statement for appropriate executable files and manuals, see the manpage for more details.

In general, you should state the problem you actually have, not what you think you need to do to fix it. Why are you where you think you are?
 
Old 06-15-2011, 07:22 AM   #3
hitmen
Member
 
Registered: Jun 2011
Distribution: Kubuntu 10.04
Posts: 158

Original Poster
Rep: Reputation: Disabled
I created a new script and saved it. locate and whereis does not detect it. However, I can see it using my gnome desktop.
 
Old 06-15-2011, 08:08 AM   #4
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
hmm,

it might be that you didn't refresh the DB for 'locate' with "updatedb &"
otherwise you can search for it with find:
Code:
#> find / -name 'yourscriptname' -ls
where / means search from 'root' dir everywhere.


good luck with finding 'yourself'

Last edited by lithos; 06-15-2011 at 08:10 AM.
 
Old 06-15-2011, 08:14 AM   #5
hitmen
Member
 
Registered: Jun 2011
Distribution: Kubuntu 10.04
Posts: 158

Original Poster
Rep: Reputation: Disabled
Do I have to do sudo updatedb every time after I log out?
I remembered I did it quite recently.
 
Old 06-15-2011, 08:52 AM   #6
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
Quote:
Originally Posted by hitmen View Post
Do I have to do sudo updatedb every time after I log out?
I remembered I did it quite recently.
No, but you do need to run updatedb after you've created anything you want to be able to find with the locate command later.

Or, you can just set a cron job to run it once a day.
 
Old 06-15-2011, 08:55 AM   #7
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
Quote:
Originally Posted by hitmen View Post
Also what is the difference between "ls bin" and "ls /bin"
"ls bin" = "ls ./bin", where the "." indicates the current working directory. So if your home directory is the current working directory, then you'll get a listing of files in /home/<userid>/bin.

"ls /bin" will give you a listing of files in /bin, because that's an absolute path, not a relative one.
 
Old 06-15-2011, 09:32 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
TBH you shouldn't want to do what you're doing. You know where the script is. In your current situation, neither command provides anything you don't already know, so I'd say just forget about it in this *specific* example, it's not important for what you're doing.
 
Old 06-15-2011, 07:19 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,406

Rep: Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396
Re updatedb, I believe most distros these days create a cronjob for that at install time; usually set to run about 4am? Have skim through your crontabs; no point in re-inventing the wheel.
 
  


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
shell script for loading 'locate'd mp3's into oskar Linux - General 8 08-12-2006 12:16 AM
Cannot locate cursor ID in X for capture script smudge|lala Programming 0 04-07-2006 08:26 PM
LXer: Locate, Find, and Whereis LXer Syndicated Linux News 0 03-28-2006 03:06 PM
whereis / locate and version Kumado SUSE / openSUSE 1 06-21-2005 03:40 PM
A few annoying problems; Cannot locate theme & "No DFP detected". Ninja Cow Slackware 0 04-29-2004 12:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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