Search is useless. How can I force it to index my hard drive (2018)
I am running Bionic Beaver and am unable to find any of my files in the standard (is it still called Unity?) GUI. If I go to a folder, it seems to be able to find those files afterward, but this is useless for files I don't already know the location of. These are actually separate problems for searching from the dock using META and searching using Ctrl+F from the file browser (is this still called Nautilus?)
I believe there are earlier versions of this question but I haven't found anything that seems to apply to my set-up yet.
18.04 nautilus gnome-shell search
|
show 1 more comment
I am running Bionic Beaver and am unable to find any of my files in the standard (is it still called Unity?) GUI. If I go to a folder, it seems to be able to find those files afterward, but this is useless for files I don't already know the location of. These are actually separate problems for searching from the dock using META and searching using Ctrl+F from the file browser (is this still called Nautilus?)
I believe there are earlier versions of this question but I haven't found anything that seems to apply to my set-up yet.
18.04 nautilus gnome-shell search
Could you please expand your question and explain what's going wrong? Which steps did you perform, what was the outcome, and what was the expected result?
– pomsky
Dec 23 '18 at 19:19
I don't know quite how to expand it. I type a phrase which is part of the name of a file I know is within the file system via one of the two search methods, and nothing is returned. The expected result is something I can click to go to my file or the containing folder. The actual result is nothing. The other answers seem to involve installing different utilities on the system. It is possible I have searched poorly. I have ignored this problem for a few days and do not remember what I did then, but I would like to be able to use the native system utilities, assuming they can be made useful.
– jdc
Dec 23 '18 at 19:34
2
Ubuntu 17.10 abandoned Unity in favour of GNOME 3, so the file browser in Bionic Beaver (Ubuntu 18.04) is indeed Nautilus.
– Christophe Strobbe
Dec 23 '18 at 19:34
2
@Chris To be clear, it's been Nautilus for a long time.
– wjandrea
Dec 23 '18 at 21:13
Not sure I understood your issue completely, but it sounds to me like you're missingtracker
pacakge's functionality. It is not shipped with Bionic by default (see known issues) as it may cause performance issues, especially in systems with low specs.
– pomsky
Dec 24 '18 at 7:30
|
show 1 more comment
I am running Bionic Beaver and am unable to find any of my files in the standard (is it still called Unity?) GUI. If I go to a folder, it seems to be able to find those files afterward, but this is useless for files I don't already know the location of. These are actually separate problems for searching from the dock using META and searching using Ctrl+F from the file browser (is this still called Nautilus?)
I believe there are earlier versions of this question but I haven't found anything that seems to apply to my set-up yet.
18.04 nautilus gnome-shell search
I am running Bionic Beaver and am unable to find any of my files in the standard (is it still called Unity?) GUI. If I go to a folder, it seems to be able to find those files afterward, but this is useless for files I don't already know the location of. These are actually separate problems for searching from the dock using META and searching using Ctrl+F from the file browser (is this still called Nautilus?)
I believe there are earlier versions of this question but I haven't found anything that seems to apply to my set-up yet.
18.04 nautilus gnome-shell search
18.04 nautilus gnome-shell search
edited Dec 23 '18 at 19:16
pomsky
33.1k11104135
33.1k11104135
asked Dec 23 '18 at 19:06
jdcjdc
1165
1165
Could you please expand your question and explain what's going wrong? Which steps did you perform, what was the outcome, and what was the expected result?
– pomsky
Dec 23 '18 at 19:19
I don't know quite how to expand it. I type a phrase which is part of the name of a file I know is within the file system via one of the two search methods, and nothing is returned. The expected result is something I can click to go to my file or the containing folder. The actual result is nothing. The other answers seem to involve installing different utilities on the system. It is possible I have searched poorly. I have ignored this problem for a few days and do not remember what I did then, but I would like to be able to use the native system utilities, assuming they can be made useful.
– jdc
Dec 23 '18 at 19:34
2
Ubuntu 17.10 abandoned Unity in favour of GNOME 3, so the file browser in Bionic Beaver (Ubuntu 18.04) is indeed Nautilus.
– Christophe Strobbe
Dec 23 '18 at 19:34
2
@Chris To be clear, it's been Nautilus for a long time.
– wjandrea
Dec 23 '18 at 21:13
Not sure I understood your issue completely, but it sounds to me like you're missingtracker
pacakge's functionality. It is not shipped with Bionic by default (see known issues) as it may cause performance issues, especially in systems with low specs.
– pomsky
Dec 24 '18 at 7:30
|
show 1 more comment
Could you please expand your question and explain what's going wrong? Which steps did you perform, what was the outcome, and what was the expected result?
– pomsky
Dec 23 '18 at 19:19
I don't know quite how to expand it. I type a phrase which is part of the name of a file I know is within the file system via one of the two search methods, and nothing is returned. The expected result is something I can click to go to my file or the containing folder. The actual result is nothing. The other answers seem to involve installing different utilities on the system. It is possible I have searched poorly. I have ignored this problem for a few days and do not remember what I did then, but I would like to be able to use the native system utilities, assuming they can be made useful.
– jdc
Dec 23 '18 at 19:34
2
Ubuntu 17.10 abandoned Unity in favour of GNOME 3, so the file browser in Bionic Beaver (Ubuntu 18.04) is indeed Nautilus.
– Christophe Strobbe
Dec 23 '18 at 19:34
2
@Chris To be clear, it's been Nautilus for a long time.
– wjandrea
Dec 23 '18 at 21:13
Not sure I understood your issue completely, but it sounds to me like you're missingtracker
pacakge's functionality. It is not shipped with Bionic by default (see known issues) as it may cause performance issues, especially in systems with low specs.
– pomsky
Dec 24 '18 at 7:30
Could you please expand your question and explain what's going wrong? Which steps did you perform, what was the outcome, and what was the expected result?
– pomsky
Dec 23 '18 at 19:19
Could you please expand your question and explain what's going wrong? Which steps did you perform, what was the outcome, and what was the expected result?
– pomsky
Dec 23 '18 at 19:19
I don't know quite how to expand it. I type a phrase which is part of the name of a file I know is within the file system via one of the two search methods, and nothing is returned. The expected result is something I can click to go to my file or the containing folder. The actual result is nothing. The other answers seem to involve installing different utilities on the system. It is possible I have searched poorly. I have ignored this problem for a few days and do not remember what I did then, but I would like to be able to use the native system utilities, assuming they can be made useful.
– jdc
Dec 23 '18 at 19:34
I don't know quite how to expand it. I type a phrase which is part of the name of a file I know is within the file system via one of the two search methods, and nothing is returned. The expected result is something I can click to go to my file or the containing folder. The actual result is nothing. The other answers seem to involve installing different utilities on the system. It is possible I have searched poorly. I have ignored this problem for a few days and do not remember what I did then, but I would like to be able to use the native system utilities, assuming they can be made useful.
– jdc
Dec 23 '18 at 19:34
2
2
Ubuntu 17.10 abandoned Unity in favour of GNOME 3, so the file browser in Bionic Beaver (Ubuntu 18.04) is indeed Nautilus.
– Christophe Strobbe
Dec 23 '18 at 19:34
Ubuntu 17.10 abandoned Unity in favour of GNOME 3, so the file browser in Bionic Beaver (Ubuntu 18.04) is indeed Nautilus.
– Christophe Strobbe
Dec 23 '18 at 19:34
2
2
@Chris To be clear, it's been Nautilus for a long time.
– wjandrea
Dec 23 '18 at 21:13
@Chris To be clear, it's been Nautilus for a long time.
– wjandrea
Dec 23 '18 at 21:13
Not sure I understood your issue completely, but it sounds to me like you're missing
tracker
pacakge's functionality. It is not shipped with Bionic by default (see known issues) as it may cause performance issues, especially in systems with low specs.– pomsky
Dec 24 '18 at 7:30
Not sure I understood your issue completely, but it sounds to me like you're missing
tracker
pacakge's functionality. It is not shipped with Bionic by default (see known issues) as it may cause performance issues, especially in systems with low specs.– pomsky
Dec 24 '18 at 7:30
|
show 1 more comment
2 Answers
2
active
oldest
votes
Files are indexed for the locate
command but normally it is updated every day so any new file you created today won't show up until tomorrow. I've circumvented this shortfall by putting sudo updatedb
as a cron job that runs every 15 minutes (it only takes a few seconds to run).
The locate
command behaves as if wildcards are used:
$ time locate etc/profile
/etc/profile
/etc/profile.d
/etc/profile.d/appmenu-qt5.sh
/etc/profile.d/apps-bin-path.sh
/etc/profile.d/bash_completion.sh
/etc/profile.d/cedilla-portuguese.sh
/etc/profile.d/jdk.csh
/etc/profile.d/jdk.sh
/etc/profile.d/vte-2.91.sh
real 0m0.696s
user 0m0.671s
sys 0m0.024s
I prefixed the locate
command with the time
command so you can see how blindingly fast it is doing lookups on indexed filenames and directory names with implied wildcards.
The locate
output is rather sparse so I created an alias llocate
to format the output nicely (How to make locate output look like `ll` or `ls -la` but nicer?):
$ time llocate etc/profile
ACCESS OWNER GROUP SIZE MODIFIED NAME (updatdb last ran: 2018-07-01 11:30:05)
-rw-r--r-- root root 575 Nov 12 2017 /etc/profile
drwxr-xr-x root root 4096 Jun 4 17:19 /etc/profile.d
-rw-r--r-- root root 40 Feb 16 2017 /etc/profile.d/appmenu-qt5.sh
-rw-r--r-- root root 580 Oct 18 2017 /etc/profile.d/apps-bin-path.sh
-rw-r--r-- root root 663 May 18 2016 /etc/profile.d/bash_completion.sh
-rw-r--r-- root root 1003 Dec 29 2015 /etc/profile.d/cedilla-portuguese.sh
-rwxr-xr-x root root 301 Feb 20 2013 /etc/profile.d/jdk.csh
-rwxr-xr-x root root 299 Feb 20 2013 /etc/profile.d/jdk.sh
-rw-r--r-- root root 1941 Mar 16 2016 /etc/profile.d/vte-2.91.sh
real 0m0.760s
user 0m0.754s
sys 0m0.020s
Notice how the heading tells you the last time files were indexed. If you can't find the file you are looking for and, was created before that time, simply run sudo updatedb
.
The time
command is used again so you can see that using llocate
is marginally slower than locate
unless a huge number of results are returned.
locate
GUI front-end glocate
Although locate
is a CLI command I've created a GUI front for it using zenity
. This is an initial "no frills" front-end that could be improved using yad
instead.
Enter up to 10 search file names / directory names
This screen appears when you start glocate
:
You can enter directory names and filenames in whole or in part.
Results returned in scroll box
glocate
takes about a second to display the results in most cases:
Bash Script
Here is the bash script you can create using:
sudo -H gedit /usr/local/bin/glocate
Then copy and paste the following line:
#!/bin/bash
# NAME: glocate
# PATH: /usr/local/bin
# DESC: Provide zenity GUI front end to locate command
# DATE: Dec 24, 2018.
# NOTE: Written for: https://askubuntu.com/questions/1104069/search-is-useless-how-can-i-force-it-to-index-my-hard-drive-2018/1104112#1104112
Init () {
# Get date `sudo updatedb` was last run
LastRun=$(stat --printf=%y /var/lib/mlocate/mlocate.db | sed 's/.[^n]*//')
SearchMax=10 # Search for up to 10 filenames or directories at once
}
GetSearchNames () {
SearchNames=$(zenity
--title "glocate - updatedb last run: $LastRun"
--text '<span foreground="blue" font="14">Enter up to 10 search names</span>'
--forms --width=800 --height=480
--add-entry="Search 1" --add-entry="Search 2" --add-entry="Search 3"
--add-entry="Search 4" --add-entry="Search 5" --add-entry="Search 6"
--add-entry="Search 7" --add-entry="Search 8" --add-entry="Search 9"
--add-entry="Search 10" 2>/dev/null)
Action="$?" # Glitch: When ESC pressed or Cancel clicked result is 0?
# echo "Action: $Action" # Remove leading # to debug
# Zenity not returning array like yad would. Build array manually
SearchArr=() # Reset array
for (( i=1; i<=$SearchMax; ++i)) ; do
Field="$(echo "$SearchNames"| cut -d '|' -f $i)"
[[ $Field != "" ]] && SearchArr+=("$Field")
done
# Click OK without search names?
CharacterCount=$(wc -c <<< "${SearchNames[@]}")
# echo "CharacterCount: $CharacterCount" # Remove leading # to debug
# if [[ "$Action" == 0 && "$CharacterCount" == "$SearchMax" ]] ; then
if [[ "$CharacterCount" -le "$SearchMax" ]] ; then
zenity --error --title="glocate"
--text="No search names entered. Program will end."
2>/dev/null
Action=99
fi
return "$Action" # 0 = Proceed with search, anything else = quit.
}
DisplaySearch () {
Result=$(locate "${SearchArr[@]}" )
zenity
--title "locate search results"
--text '<span foreground="blue" font="14">Scroll to see more results</span>'
--list --separator="$IFS" --width=800 --height=480
--hide-header --column "Directory and filenames"
"${Result[@]}" 2>/dev/null
}
Main () {
Init
while GetSearchNames ; do DisplaySearch ; done
}
Main
Save the file and exit gedit
.
Mark the script as executable using:
sudo chmod a+x /usr/local/bin/glocate
If you want to create a desktop shortcut see: An easy way to create a desktop shortcut?
To call the script from the terminal simply use: glocate
.
2
+1; I think it is a good idea to add a GUI to locate (unless you think that recoll is good enough for GUI users).
– sudodus
Dec 24 '18 at 6:01
Is Dropbox included in thesudo updatedb
? I do this and it is done almost instantly, but I can search for strings included in filenames in Dropbox and get no result.
– jdc
Dec 24 '18 at 6:25
@jdc Sorry I don't know the inner workings of Dropbox.
– WinEunuuchs2Unix
Dec 24 '18 at 13:06
@sudodus I shall begin developing azenity
based script calledglocate
. I'll ping you when done for your valuable critiquing :).
– WinEunuuchs2Unix
Dec 24 '18 at 13:10
@WinEunuuchs2Unix, Good luck :-)
– sudodus
Dec 24 '18 at 13:52
|
show 3 more comments
GUI tools
In a graphical desktop environment you can try Recoll, which is a powerful tool that can search for file names as well as file content.
When installed, see
man recoll
or a tutorial via the internet to learn more about it.
Typically the
recoll
command will start the graphical user interface for querying the Recoll database.On the first run, recoll will create the user configuration which can be customized before starting the first indexation.
Link: Recoll is a desktop full-text search tool
glocate
is a brand new GUI forlocate
made by @WinEunuuchs2Unix and described in another answer here. It is very basic and also easy to use.
Command line tools
In a text screen or terminal window you can use command lines with find
and grep
.
find
is a very powerful tool to find files. Examples:
find / -iname "*autostart*" # to search everywhere
find ~ -iname "*autostart*" # to search in your home directory
Use elevated permissions,
sudo find ...
if there are directories, that you are not allowed to search as a regular user. Seeman find
or a tutorial via the internet to learn more about it.
grep
is a very powerful tool to find text strings in files (search for file content). Examples
grep 'alias' ~/.bashrc
See
man grep
or a tutorial via the internet to learn more about it.
locate
is a fast tool to find files when it has an updated database. Seeman locate
or a tutorial via the internet to learn more about it.
Update the data-base for
locate
with
sudo updatedb
and if it does not include a secondary file system, that is mounted in
/media
, you can edit the configuration file to make it include it (or move the mountpoint to/mnt
, but that may cause problems with hardcoded paths),
cd /etc
sudo cp -p updatedb.conf updatedb.conf.bak
sudo nano updatedb.conf
Thank you! I've been usingfind
. I seem to remember not needing to use the optioniname
in the past, bu tseem to need to now; has this changed? Perhaps I should just installRecoll
, but do you know if there is any way to force the GUI tools that come with the system, available at the touch of a button, to index my directories so that I can use them?
– jdc
Dec 24 '18 at 6:20
1
1. You can still use-name
, it makes a difference between upper case and lower case.-iname
will search for both, for example "find -iname "*.jpg" will find jpg files and JPG files; 2. I suggest that you installrecoll
. I don't know if there is a 'default' indexing like in Windows, unless we can consider thatlocate
and its database have that role.
– sudodus
Dec 24 '18 at 6:36
OK, I've installedrecoll
; is there any way to integrate it with the system so I can find files by hitting META and typing like I'm used to?
– jdc
Dec 24 '18 at 7:51
@jdc, Probably, you can do almost everything with linux, but I don't know how to integrate it completely. You could make a desktop icon or try to get it into the dock at the left side. Other people are better at manipulating the desktop environment. You have a better chance to get help, if you create a separate question for that problem: "How to integraterecoll
into the desktop environment to get a quick access to it".
– sudodus
Dec 24 '18 at 11:53
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1104069%2fsearch-is-useless-how-can-i-force-it-to-index-my-hard-drive-2018%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Files are indexed for the locate
command but normally it is updated every day so any new file you created today won't show up until tomorrow. I've circumvented this shortfall by putting sudo updatedb
as a cron job that runs every 15 minutes (it only takes a few seconds to run).
The locate
command behaves as if wildcards are used:
$ time locate etc/profile
/etc/profile
/etc/profile.d
/etc/profile.d/appmenu-qt5.sh
/etc/profile.d/apps-bin-path.sh
/etc/profile.d/bash_completion.sh
/etc/profile.d/cedilla-portuguese.sh
/etc/profile.d/jdk.csh
/etc/profile.d/jdk.sh
/etc/profile.d/vte-2.91.sh
real 0m0.696s
user 0m0.671s
sys 0m0.024s
I prefixed the locate
command with the time
command so you can see how blindingly fast it is doing lookups on indexed filenames and directory names with implied wildcards.
The locate
output is rather sparse so I created an alias llocate
to format the output nicely (How to make locate output look like `ll` or `ls -la` but nicer?):
$ time llocate etc/profile
ACCESS OWNER GROUP SIZE MODIFIED NAME (updatdb last ran: 2018-07-01 11:30:05)
-rw-r--r-- root root 575 Nov 12 2017 /etc/profile
drwxr-xr-x root root 4096 Jun 4 17:19 /etc/profile.d
-rw-r--r-- root root 40 Feb 16 2017 /etc/profile.d/appmenu-qt5.sh
-rw-r--r-- root root 580 Oct 18 2017 /etc/profile.d/apps-bin-path.sh
-rw-r--r-- root root 663 May 18 2016 /etc/profile.d/bash_completion.sh
-rw-r--r-- root root 1003 Dec 29 2015 /etc/profile.d/cedilla-portuguese.sh
-rwxr-xr-x root root 301 Feb 20 2013 /etc/profile.d/jdk.csh
-rwxr-xr-x root root 299 Feb 20 2013 /etc/profile.d/jdk.sh
-rw-r--r-- root root 1941 Mar 16 2016 /etc/profile.d/vte-2.91.sh
real 0m0.760s
user 0m0.754s
sys 0m0.020s
Notice how the heading tells you the last time files were indexed. If you can't find the file you are looking for and, was created before that time, simply run sudo updatedb
.
The time
command is used again so you can see that using llocate
is marginally slower than locate
unless a huge number of results are returned.
locate
GUI front-end glocate
Although locate
is a CLI command I've created a GUI front for it using zenity
. This is an initial "no frills" front-end that could be improved using yad
instead.
Enter up to 10 search file names / directory names
This screen appears when you start glocate
:
You can enter directory names and filenames in whole or in part.
Results returned in scroll box
glocate
takes about a second to display the results in most cases:
Bash Script
Here is the bash script you can create using:
sudo -H gedit /usr/local/bin/glocate
Then copy and paste the following line:
#!/bin/bash
# NAME: glocate
# PATH: /usr/local/bin
# DESC: Provide zenity GUI front end to locate command
# DATE: Dec 24, 2018.
# NOTE: Written for: https://askubuntu.com/questions/1104069/search-is-useless-how-can-i-force-it-to-index-my-hard-drive-2018/1104112#1104112
Init () {
# Get date `sudo updatedb` was last run
LastRun=$(stat --printf=%y /var/lib/mlocate/mlocate.db | sed 's/.[^n]*//')
SearchMax=10 # Search for up to 10 filenames or directories at once
}
GetSearchNames () {
SearchNames=$(zenity
--title "glocate - updatedb last run: $LastRun"
--text '<span foreground="blue" font="14">Enter up to 10 search names</span>'
--forms --width=800 --height=480
--add-entry="Search 1" --add-entry="Search 2" --add-entry="Search 3"
--add-entry="Search 4" --add-entry="Search 5" --add-entry="Search 6"
--add-entry="Search 7" --add-entry="Search 8" --add-entry="Search 9"
--add-entry="Search 10" 2>/dev/null)
Action="$?" # Glitch: When ESC pressed or Cancel clicked result is 0?
# echo "Action: $Action" # Remove leading # to debug
# Zenity not returning array like yad would. Build array manually
SearchArr=() # Reset array
for (( i=1; i<=$SearchMax; ++i)) ; do
Field="$(echo "$SearchNames"| cut -d '|' -f $i)"
[[ $Field != "" ]] && SearchArr+=("$Field")
done
# Click OK without search names?
CharacterCount=$(wc -c <<< "${SearchNames[@]}")
# echo "CharacterCount: $CharacterCount" # Remove leading # to debug
# if [[ "$Action" == 0 && "$CharacterCount" == "$SearchMax" ]] ; then
if [[ "$CharacterCount" -le "$SearchMax" ]] ; then
zenity --error --title="glocate"
--text="No search names entered. Program will end."
2>/dev/null
Action=99
fi
return "$Action" # 0 = Proceed with search, anything else = quit.
}
DisplaySearch () {
Result=$(locate "${SearchArr[@]}" )
zenity
--title "locate search results"
--text '<span foreground="blue" font="14">Scroll to see more results</span>'
--list --separator="$IFS" --width=800 --height=480
--hide-header --column "Directory and filenames"
"${Result[@]}" 2>/dev/null
}
Main () {
Init
while GetSearchNames ; do DisplaySearch ; done
}
Main
Save the file and exit gedit
.
Mark the script as executable using:
sudo chmod a+x /usr/local/bin/glocate
If you want to create a desktop shortcut see: An easy way to create a desktop shortcut?
To call the script from the terminal simply use: glocate
.
2
+1; I think it is a good idea to add a GUI to locate (unless you think that recoll is good enough for GUI users).
– sudodus
Dec 24 '18 at 6:01
Is Dropbox included in thesudo updatedb
? I do this and it is done almost instantly, but I can search for strings included in filenames in Dropbox and get no result.
– jdc
Dec 24 '18 at 6:25
@jdc Sorry I don't know the inner workings of Dropbox.
– WinEunuuchs2Unix
Dec 24 '18 at 13:06
@sudodus I shall begin developing azenity
based script calledglocate
. I'll ping you when done for your valuable critiquing :).
– WinEunuuchs2Unix
Dec 24 '18 at 13:10
@WinEunuuchs2Unix, Good luck :-)
– sudodus
Dec 24 '18 at 13:52
|
show 3 more comments
Files are indexed for the locate
command but normally it is updated every day so any new file you created today won't show up until tomorrow. I've circumvented this shortfall by putting sudo updatedb
as a cron job that runs every 15 minutes (it only takes a few seconds to run).
The locate
command behaves as if wildcards are used:
$ time locate etc/profile
/etc/profile
/etc/profile.d
/etc/profile.d/appmenu-qt5.sh
/etc/profile.d/apps-bin-path.sh
/etc/profile.d/bash_completion.sh
/etc/profile.d/cedilla-portuguese.sh
/etc/profile.d/jdk.csh
/etc/profile.d/jdk.sh
/etc/profile.d/vte-2.91.sh
real 0m0.696s
user 0m0.671s
sys 0m0.024s
I prefixed the locate
command with the time
command so you can see how blindingly fast it is doing lookups on indexed filenames and directory names with implied wildcards.
The locate
output is rather sparse so I created an alias llocate
to format the output nicely (How to make locate output look like `ll` or `ls -la` but nicer?):
$ time llocate etc/profile
ACCESS OWNER GROUP SIZE MODIFIED NAME (updatdb last ran: 2018-07-01 11:30:05)
-rw-r--r-- root root 575 Nov 12 2017 /etc/profile
drwxr-xr-x root root 4096 Jun 4 17:19 /etc/profile.d
-rw-r--r-- root root 40 Feb 16 2017 /etc/profile.d/appmenu-qt5.sh
-rw-r--r-- root root 580 Oct 18 2017 /etc/profile.d/apps-bin-path.sh
-rw-r--r-- root root 663 May 18 2016 /etc/profile.d/bash_completion.sh
-rw-r--r-- root root 1003 Dec 29 2015 /etc/profile.d/cedilla-portuguese.sh
-rwxr-xr-x root root 301 Feb 20 2013 /etc/profile.d/jdk.csh
-rwxr-xr-x root root 299 Feb 20 2013 /etc/profile.d/jdk.sh
-rw-r--r-- root root 1941 Mar 16 2016 /etc/profile.d/vte-2.91.sh
real 0m0.760s
user 0m0.754s
sys 0m0.020s
Notice how the heading tells you the last time files were indexed. If you can't find the file you are looking for and, was created before that time, simply run sudo updatedb
.
The time
command is used again so you can see that using llocate
is marginally slower than locate
unless a huge number of results are returned.
locate
GUI front-end glocate
Although locate
is a CLI command I've created a GUI front for it using zenity
. This is an initial "no frills" front-end that could be improved using yad
instead.
Enter up to 10 search file names / directory names
This screen appears when you start glocate
:
You can enter directory names and filenames in whole or in part.
Results returned in scroll box
glocate
takes about a second to display the results in most cases:
Bash Script
Here is the bash script you can create using:
sudo -H gedit /usr/local/bin/glocate
Then copy and paste the following line:
#!/bin/bash
# NAME: glocate
# PATH: /usr/local/bin
# DESC: Provide zenity GUI front end to locate command
# DATE: Dec 24, 2018.
# NOTE: Written for: https://askubuntu.com/questions/1104069/search-is-useless-how-can-i-force-it-to-index-my-hard-drive-2018/1104112#1104112
Init () {
# Get date `sudo updatedb` was last run
LastRun=$(stat --printf=%y /var/lib/mlocate/mlocate.db | sed 's/.[^n]*//')
SearchMax=10 # Search for up to 10 filenames or directories at once
}
GetSearchNames () {
SearchNames=$(zenity
--title "glocate - updatedb last run: $LastRun"
--text '<span foreground="blue" font="14">Enter up to 10 search names</span>'
--forms --width=800 --height=480
--add-entry="Search 1" --add-entry="Search 2" --add-entry="Search 3"
--add-entry="Search 4" --add-entry="Search 5" --add-entry="Search 6"
--add-entry="Search 7" --add-entry="Search 8" --add-entry="Search 9"
--add-entry="Search 10" 2>/dev/null)
Action="$?" # Glitch: When ESC pressed or Cancel clicked result is 0?
# echo "Action: $Action" # Remove leading # to debug
# Zenity not returning array like yad would. Build array manually
SearchArr=() # Reset array
for (( i=1; i<=$SearchMax; ++i)) ; do
Field="$(echo "$SearchNames"| cut -d '|' -f $i)"
[[ $Field != "" ]] && SearchArr+=("$Field")
done
# Click OK without search names?
CharacterCount=$(wc -c <<< "${SearchNames[@]}")
# echo "CharacterCount: $CharacterCount" # Remove leading # to debug
# if [[ "$Action" == 0 && "$CharacterCount" == "$SearchMax" ]] ; then
if [[ "$CharacterCount" -le "$SearchMax" ]] ; then
zenity --error --title="glocate"
--text="No search names entered. Program will end."
2>/dev/null
Action=99
fi
return "$Action" # 0 = Proceed with search, anything else = quit.
}
DisplaySearch () {
Result=$(locate "${SearchArr[@]}" )
zenity
--title "locate search results"
--text '<span foreground="blue" font="14">Scroll to see more results</span>'
--list --separator="$IFS" --width=800 --height=480
--hide-header --column "Directory and filenames"
"${Result[@]}" 2>/dev/null
}
Main () {
Init
while GetSearchNames ; do DisplaySearch ; done
}
Main
Save the file and exit gedit
.
Mark the script as executable using:
sudo chmod a+x /usr/local/bin/glocate
If you want to create a desktop shortcut see: An easy way to create a desktop shortcut?
To call the script from the terminal simply use: glocate
.
2
+1; I think it is a good idea to add a GUI to locate (unless you think that recoll is good enough for GUI users).
– sudodus
Dec 24 '18 at 6:01
Is Dropbox included in thesudo updatedb
? I do this and it is done almost instantly, but I can search for strings included in filenames in Dropbox and get no result.
– jdc
Dec 24 '18 at 6:25
@jdc Sorry I don't know the inner workings of Dropbox.
– WinEunuuchs2Unix
Dec 24 '18 at 13:06
@sudodus I shall begin developing azenity
based script calledglocate
. I'll ping you when done for your valuable critiquing :).
– WinEunuuchs2Unix
Dec 24 '18 at 13:10
@WinEunuuchs2Unix, Good luck :-)
– sudodus
Dec 24 '18 at 13:52
|
show 3 more comments
Files are indexed for the locate
command but normally it is updated every day so any new file you created today won't show up until tomorrow. I've circumvented this shortfall by putting sudo updatedb
as a cron job that runs every 15 minutes (it only takes a few seconds to run).
The locate
command behaves as if wildcards are used:
$ time locate etc/profile
/etc/profile
/etc/profile.d
/etc/profile.d/appmenu-qt5.sh
/etc/profile.d/apps-bin-path.sh
/etc/profile.d/bash_completion.sh
/etc/profile.d/cedilla-portuguese.sh
/etc/profile.d/jdk.csh
/etc/profile.d/jdk.sh
/etc/profile.d/vte-2.91.sh
real 0m0.696s
user 0m0.671s
sys 0m0.024s
I prefixed the locate
command with the time
command so you can see how blindingly fast it is doing lookups on indexed filenames and directory names with implied wildcards.
The locate
output is rather sparse so I created an alias llocate
to format the output nicely (How to make locate output look like `ll` or `ls -la` but nicer?):
$ time llocate etc/profile
ACCESS OWNER GROUP SIZE MODIFIED NAME (updatdb last ran: 2018-07-01 11:30:05)
-rw-r--r-- root root 575 Nov 12 2017 /etc/profile
drwxr-xr-x root root 4096 Jun 4 17:19 /etc/profile.d
-rw-r--r-- root root 40 Feb 16 2017 /etc/profile.d/appmenu-qt5.sh
-rw-r--r-- root root 580 Oct 18 2017 /etc/profile.d/apps-bin-path.sh
-rw-r--r-- root root 663 May 18 2016 /etc/profile.d/bash_completion.sh
-rw-r--r-- root root 1003 Dec 29 2015 /etc/profile.d/cedilla-portuguese.sh
-rwxr-xr-x root root 301 Feb 20 2013 /etc/profile.d/jdk.csh
-rwxr-xr-x root root 299 Feb 20 2013 /etc/profile.d/jdk.sh
-rw-r--r-- root root 1941 Mar 16 2016 /etc/profile.d/vte-2.91.sh
real 0m0.760s
user 0m0.754s
sys 0m0.020s
Notice how the heading tells you the last time files were indexed. If you can't find the file you are looking for and, was created before that time, simply run sudo updatedb
.
The time
command is used again so you can see that using llocate
is marginally slower than locate
unless a huge number of results are returned.
locate
GUI front-end glocate
Although locate
is a CLI command I've created a GUI front for it using zenity
. This is an initial "no frills" front-end that could be improved using yad
instead.
Enter up to 10 search file names / directory names
This screen appears when you start glocate
:
You can enter directory names and filenames in whole or in part.
Results returned in scroll box
glocate
takes about a second to display the results in most cases:
Bash Script
Here is the bash script you can create using:
sudo -H gedit /usr/local/bin/glocate
Then copy and paste the following line:
#!/bin/bash
# NAME: glocate
# PATH: /usr/local/bin
# DESC: Provide zenity GUI front end to locate command
# DATE: Dec 24, 2018.
# NOTE: Written for: https://askubuntu.com/questions/1104069/search-is-useless-how-can-i-force-it-to-index-my-hard-drive-2018/1104112#1104112
Init () {
# Get date `sudo updatedb` was last run
LastRun=$(stat --printf=%y /var/lib/mlocate/mlocate.db | sed 's/.[^n]*//')
SearchMax=10 # Search for up to 10 filenames or directories at once
}
GetSearchNames () {
SearchNames=$(zenity
--title "glocate - updatedb last run: $LastRun"
--text '<span foreground="blue" font="14">Enter up to 10 search names</span>'
--forms --width=800 --height=480
--add-entry="Search 1" --add-entry="Search 2" --add-entry="Search 3"
--add-entry="Search 4" --add-entry="Search 5" --add-entry="Search 6"
--add-entry="Search 7" --add-entry="Search 8" --add-entry="Search 9"
--add-entry="Search 10" 2>/dev/null)
Action="$?" # Glitch: When ESC pressed or Cancel clicked result is 0?
# echo "Action: $Action" # Remove leading # to debug
# Zenity not returning array like yad would. Build array manually
SearchArr=() # Reset array
for (( i=1; i<=$SearchMax; ++i)) ; do
Field="$(echo "$SearchNames"| cut -d '|' -f $i)"
[[ $Field != "" ]] && SearchArr+=("$Field")
done
# Click OK without search names?
CharacterCount=$(wc -c <<< "${SearchNames[@]}")
# echo "CharacterCount: $CharacterCount" # Remove leading # to debug
# if [[ "$Action" == 0 && "$CharacterCount" == "$SearchMax" ]] ; then
if [[ "$CharacterCount" -le "$SearchMax" ]] ; then
zenity --error --title="glocate"
--text="No search names entered. Program will end."
2>/dev/null
Action=99
fi
return "$Action" # 0 = Proceed with search, anything else = quit.
}
DisplaySearch () {
Result=$(locate "${SearchArr[@]}" )
zenity
--title "locate search results"
--text '<span foreground="blue" font="14">Scroll to see more results</span>'
--list --separator="$IFS" --width=800 --height=480
--hide-header --column "Directory and filenames"
"${Result[@]}" 2>/dev/null
}
Main () {
Init
while GetSearchNames ; do DisplaySearch ; done
}
Main
Save the file and exit gedit
.
Mark the script as executable using:
sudo chmod a+x /usr/local/bin/glocate
If you want to create a desktop shortcut see: An easy way to create a desktop shortcut?
To call the script from the terminal simply use: glocate
.
Files are indexed for the locate
command but normally it is updated every day so any new file you created today won't show up until tomorrow. I've circumvented this shortfall by putting sudo updatedb
as a cron job that runs every 15 minutes (it only takes a few seconds to run).
The locate
command behaves as if wildcards are used:
$ time locate etc/profile
/etc/profile
/etc/profile.d
/etc/profile.d/appmenu-qt5.sh
/etc/profile.d/apps-bin-path.sh
/etc/profile.d/bash_completion.sh
/etc/profile.d/cedilla-portuguese.sh
/etc/profile.d/jdk.csh
/etc/profile.d/jdk.sh
/etc/profile.d/vte-2.91.sh
real 0m0.696s
user 0m0.671s
sys 0m0.024s
I prefixed the locate
command with the time
command so you can see how blindingly fast it is doing lookups on indexed filenames and directory names with implied wildcards.
The locate
output is rather sparse so I created an alias llocate
to format the output nicely (How to make locate output look like `ll` or `ls -la` but nicer?):
$ time llocate etc/profile
ACCESS OWNER GROUP SIZE MODIFIED NAME (updatdb last ran: 2018-07-01 11:30:05)
-rw-r--r-- root root 575 Nov 12 2017 /etc/profile
drwxr-xr-x root root 4096 Jun 4 17:19 /etc/profile.d
-rw-r--r-- root root 40 Feb 16 2017 /etc/profile.d/appmenu-qt5.sh
-rw-r--r-- root root 580 Oct 18 2017 /etc/profile.d/apps-bin-path.sh
-rw-r--r-- root root 663 May 18 2016 /etc/profile.d/bash_completion.sh
-rw-r--r-- root root 1003 Dec 29 2015 /etc/profile.d/cedilla-portuguese.sh
-rwxr-xr-x root root 301 Feb 20 2013 /etc/profile.d/jdk.csh
-rwxr-xr-x root root 299 Feb 20 2013 /etc/profile.d/jdk.sh
-rw-r--r-- root root 1941 Mar 16 2016 /etc/profile.d/vte-2.91.sh
real 0m0.760s
user 0m0.754s
sys 0m0.020s
Notice how the heading tells you the last time files were indexed. If you can't find the file you are looking for and, was created before that time, simply run sudo updatedb
.
The time
command is used again so you can see that using llocate
is marginally slower than locate
unless a huge number of results are returned.
locate
GUI front-end glocate
Although locate
is a CLI command I've created a GUI front for it using zenity
. This is an initial "no frills" front-end that could be improved using yad
instead.
Enter up to 10 search file names / directory names
This screen appears when you start glocate
:
You can enter directory names and filenames in whole or in part.
Results returned in scroll box
glocate
takes about a second to display the results in most cases:
Bash Script
Here is the bash script you can create using:
sudo -H gedit /usr/local/bin/glocate
Then copy and paste the following line:
#!/bin/bash
# NAME: glocate
# PATH: /usr/local/bin
# DESC: Provide zenity GUI front end to locate command
# DATE: Dec 24, 2018.
# NOTE: Written for: https://askubuntu.com/questions/1104069/search-is-useless-how-can-i-force-it-to-index-my-hard-drive-2018/1104112#1104112
Init () {
# Get date `sudo updatedb` was last run
LastRun=$(stat --printf=%y /var/lib/mlocate/mlocate.db | sed 's/.[^n]*//')
SearchMax=10 # Search for up to 10 filenames or directories at once
}
GetSearchNames () {
SearchNames=$(zenity
--title "glocate - updatedb last run: $LastRun"
--text '<span foreground="blue" font="14">Enter up to 10 search names</span>'
--forms --width=800 --height=480
--add-entry="Search 1" --add-entry="Search 2" --add-entry="Search 3"
--add-entry="Search 4" --add-entry="Search 5" --add-entry="Search 6"
--add-entry="Search 7" --add-entry="Search 8" --add-entry="Search 9"
--add-entry="Search 10" 2>/dev/null)
Action="$?" # Glitch: When ESC pressed or Cancel clicked result is 0?
# echo "Action: $Action" # Remove leading # to debug
# Zenity not returning array like yad would. Build array manually
SearchArr=() # Reset array
for (( i=1; i<=$SearchMax; ++i)) ; do
Field="$(echo "$SearchNames"| cut -d '|' -f $i)"
[[ $Field != "" ]] && SearchArr+=("$Field")
done
# Click OK without search names?
CharacterCount=$(wc -c <<< "${SearchNames[@]}")
# echo "CharacterCount: $CharacterCount" # Remove leading # to debug
# if [[ "$Action" == 0 && "$CharacterCount" == "$SearchMax" ]] ; then
if [[ "$CharacterCount" -le "$SearchMax" ]] ; then
zenity --error --title="glocate"
--text="No search names entered. Program will end."
2>/dev/null
Action=99
fi
return "$Action" # 0 = Proceed with search, anything else = quit.
}
DisplaySearch () {
Result=$(locate "${SearchArr[@]}" )
zenity
--title "locate search results"
--text '<span foreground="blue" font="14">Scroll to see more results</span>'
--list --separator="$IFS" --width=800 --height=480
--hide-header --column "Directory and filenames"
"${Result[@]}" 2>/dev/null
}
Main () {
Init
while GetSearchNames ; do DisplaySearch ; done
}
Main
Save the file and exit gedit
.
Mark the script as executable using:
sudo chmod a+x /usr/local/bin/glocate
If you want to create a desktop shortcut see: An easy way to create a desktop shortcut?
To call the script from the terminal simply use: glocate
.
edited Dec 24 '18 at 21:36
answered Dec 24 '18 at 0:01
WinEunuuchs2UnixWinEunuuchs2Unix
47.3k1190183
47.3k1190183
2
+1; I think it is a good idea to add a GUI to locate (unless you think that recoll is good enough for GUI users).
– sudodus
Dec 24 '18 at 6:01
Is Dropbox included in thesudo updatedb
? I do this and it is done almost instantly, but I can search for strings included in filenames in Dropbox and get no result.
– jdc
Dec 24 '18 at 6:25
@jdc Sorry I don't know the inner workings of Dropbox.
– WinEunuuchs2Unix
Dec 24 '18 at 13:06
@sudodus I shall begin developing azenity
based script calledglocate
. I'll ping you when done for your valuable critiquing :).
– WinEunuuchs2Unix
Dec 24 '18 at 13:10
@WinEunuuchs2Unix, Good luck :-)
– sudodus
Dec 24 '18 at 13:52
|
show 3 more comments
2
+1; I think it is a good idea to add a GUI to locate (unless you think that recoll is good enough for GUI users).
– sudodus
Dec 24 '18 at 6:01
Is Dropbox included in thesudo updatedb
? I do this and it is done almost instantly, but I can search for strings included in filenames in Dropbox and get no result.
– jdc
Dec 24 '18 at 6:25
@jdc Sorry I don't know the inner workings of Dropbox.
– WinEunuuchs2Unix
Dec 24 '18 at 13:06
@sudodus I shall begin developing azenity
based script calledglocate
. I'll ping you when done for your valuable critiquing :).
– WinEunuuchs2Unix
Dec 24 '18 at 13:10
@WinEunuuchs2Unix, Good luck :-)
– sudodus
Dec 24 '18 at 13:52
2
2
+1; I think it is a good idea to add a GUI to locate (unless you think that recoll is good enough for GUI users).
– sudodus
Dec 24 '18 at 6:01
+1; I think it is a good idea to add a GUI to locate (unless you think that recoll is good enough for GUI users).
– sudodus
Dec 24 '18 at 6:01
Is Dropbox included in the
sudo updatedb
? I do this and it is done almost instantly, but I can search for strings included in filenames in Dropbox and get no result.– jdc
Dec 24 '18 at 6:25
Is Dropbox included in the
sudo updatedb
? I do this and it is done almost instantly, but I can search for strings included in filenames in Dropbox and get no result.– jdc
Dec 24 '18 at 6:25
@jdc Sorry I don't know the inner workings of Dropbox.
– WinEunuuchs2Unix
Dec 24 '18 at 13:06
@jdc Sorry I don't know the inner workings of Dropbox.
– WinEunuuchs2Unix
Dec 24 '18 at 13:06
@sudodus I shall begin developing a
zenity
based script called glocate
. I'll ping you when done for your valuable critiquing :).– WinEunuuchs2Unix
Dec 24 '18 at 13:10
@sudodus I shall begin developing a
zenity
based script called glocate
. I'll ping you when done for your valuable critiquing :).– WinEunuuchs2Unix
Dec 24 '18 at 13:10
@WinEunuuchs2Unix, Good luck :-)
– sudodus
Dec 24 '18 at 13:52
@WinEunuuchs2Unix, Good luck :-)
– sudodus
Dec 24 '18 at 13:52
|
show 3 more comments
GUI tools
In a graphical desktop environment you can try Recoll, which is a powerful tool that can search for file names as well as file content.
When installed, see
man recoll
or a tutorial via the internet to learn more about it.
Typically the
recoll
command will start the graphical user interface for querying the Recoll database.On the first run, recoll will create the user configuration which can be customized before starting the first indexation.
Link: Recoll is a desktop full-text search tool
glocate
is a brand new GUI forlocate
made by @WinEunuuchs2Unix and described in another answer here. It is very basic and also easy to use.
Command line tools
In a text screen or terminal window you can use command lines with find
and grep
.
find
is a very powerful tool to find files. Examples:
find / -iname "*autostart*" # to search everywhere
find ~ -iname "*autostart*" # to search in your home directory
Use elevated permissions,
sudo find ...
if there are directories, that you are not allowed to search as a regular user. Seeman find
or a tutorial via the internet to learn more about it.
grep
is a very powerful tool to find text strings in files (search for file content). Examples
grep 'alias' ~/.bashrc
See
man grep
or a tutorial via the internet to learn more about it.
locate
is a fast tool to find files when it has an updated database. Seeman locate
or a tutorial via the internet to learn more about it.
Update the data-base for
locate
with
sudo updatedb
and if it does not include a secondary file system, that is mounted in
/media
, you can edit the configuration file to make it include it (or move the mountpoint to/mnt
, but that may cause problems with hardcoded paths),
cd /etc
sudo cp -p updatedb.conf updatedb.conf.bak
sudo nano updatedb.conf
Thank you! I've been usingfind
. I seem to remember not needing to use the optioniname
in the past, bu tseem to need to now; has this changed? Perhaps I should just installRecoll
, but do you know if there is any way to force the GUI tools that come with the system, available at the touch of a button, to index my directories so that I can use them?
– jdc
Dec 24 '18 at 6:20
1
1. You can still use-name
, it makes a difference between upper case and lower case.-iname
will search for both, for example "find -iname "*.jpg" will find jpg files and JPG files; 2. I suggest that you installrecoll
. I don't know if there is a 'default' indexing like in Windows, unless we can consider thatlocate
and its database have that role.
– sudodus
Dec 24 '18 at 6:36
OK, I've installedrecoll
; is there any way to integrate it with the system so I can find files by hitting META and typing like I'm used to?
– jdc
Dec 24 '18 at 7:51
@jdc, Probably, you can do almost everything with linux, but I don't know how to integrate it completely. You could make a desktop icon or try to get it into the dock at the left side. Other people are better at manipulating the desktop environment. You have a better chance to get help, if you create a separate question for that problem: "How to integraterecoll
into the desktop environment to get a quick access to it".
– sudodus
Dec 24 '18 at 11:53
add a comment |
GUI tools
In a graphical desktop environment you can try Recoll, which is a powerful tool that can search for file names as well as file content.
When installed, see
man recoll
or a tutorial via the internet to learn more about it.
Typically the
recoll
command will start the graphical user interface for querying the Recoll database.On the first run, recoll will create the user configuration which can be customized before starting the first indexation.
Link: Recoll is a desktop full-text search tool
glocate
is a brand new GUI forlocate
made by @WinEunuuchs2Unix and described in another answer here. It is very basic and also easy to use.
Command line tools
In a text screen or terminal window you can use command lines with find
and grep
.
find
is a very powerful tool to find files. Examples:
find / -iname "*autostart*" # to search everywhere
find ~ -iname "*autostart*" # to search in your home directory
Use elevated permissions,
sudo find ...
if there are directories, that you are not allowed to search as a regular user. Seeman find
or a tutorial via the internet to learn more about it.
grep
is a very powerful tool to find text strings in files (search for file content). Examples
grep 'alias' ~/.bashrc
See
man grep
or a tutorial via the internet to learn more about it.
locate
is a fast tool to find files when it has an updated database. Seeman locate
or a tutorial via the internet to learn more about it.
Update the data-base for
locate
with
sudo updatedb
and if it does not include a secondary file system, that is mounted in
/media
, you can edit the configuration file to make it include it (or move the mountpoint to/mnt
, but that may cause problems with hardcoded paths),
cd /etc
sudo cp -p updatedb.conf updatedb.conf.bak
sudo nano updatedb.conf
Thank you! I've been usingfind
. I seem to remember not needing to use the optioniname
in the past, bu tseem to need to now; has this changed? Perhaps I should just installRecoll
, but do you know if there is any way to force the GUI tools that come with the system, available at the touch of a button, to index my directories so that I can use them?
– jdc
Dec 24 '18 at 6:20
1
1. You can still use-name
, it makes a difference between upper case and lower case.-iname
will search for both, for example "find -iname "*.jpg" will find jpg files and JPG files; 2. I suggest that you installrecoll
. I don't know if there is a 'default' indexing like in Windows, unless we can consider thatlocate
and its database have that role.
– sudodus
Dec 24 '18 at 6:36
OK, I've installedrecoll
; is there any way to integrate it with the system so I can find files by hitting META and typing like I'm used to?
– jdc
Dec 24 '18 at 7:51
@jdc, Probably, you can do almost everything with linux, but I don't know how to integrate it completely. You could make a desktop icon or try to get it into the dock at the left side. Other people are better at manipulating the desktop environment. You have a better chance to get help, if you create a separate question for that problem: "How to integraterecoll
into the desktop environment to get a quick access to it".
– sudodus
Dec 24 '18 at 11:53
add a comment |
GUI tools
In a graphical desktop environment you can try Recoll, which is a powerful tool that can search for file names as well as file content.
When installed, see
man recoll
or a tutorial via the internet to learn more about it.
Typically the
recoll
command will start the graphical user interface for querying the Recoll database.On the first run, recoll will create the user configuration which can be customized before starting the first indexation.
Link: Recoll is a desktop full-text search tool
glocate
is a brand new GUI forlocate
made by @WinEunuuchs2Unix and described in another answer here. It is very basic and also easy to use.
Command line tools
In a text screen or terminal window you can use command lines with find
and grep
.
find
is a very powerful tool to find files. Examples:
find / -iname "*autostart*" # to search everywhere
find ~ -iname "*autostart*" # to search in your home directory
Use elevated permissions,
sudo find ...
if there are directories, that you are not allowed to search as a regular user. Seeman find
or a tutorial via the internet to learn more about it.
grep
is a very powerful tool to find text strings in files (search for file content). Examples
grep 'alias' ~/.bashrc
See
man grep
or a tutorial via the internet to learn more about it.
locate
is a fast tool to find files when it has an updated database. Seeman locate
or a tutorial via the internet to learn more about it.
Update the data-base for
locate
with
sudo updatedb
and if it does not include a secondary file system, that is mounted in
/media
, you can edit the configuration file to make it include it (or move the mountpoint to/mnt
, but that may cause problems with hardcoded paths),
cd /etc
sudo cp -p updatedb.conf updatedb.conf.bak
sudo nano updatedb.conf
GUI tools
In a graphical desktop environment you can try Recoll, which is a powerful tool that can search for file names as well as file content.
When installed, see
man recoll
or a tutorial via the internet to learn more about it.
Typically the
recoll
command will start the graphical user interface for querying the Recoll database.On the first run, recoll will create the user configuration which can be customized before starting the first indexation.
Link: Recoll is a desktop full-text search tool
glocate
is a brand new GUI forlocate
made by @WinEunuuchs2Unix and described in another answer here. It is very basic and also easy to use.
Command line tools
In a text screen or terminal window you can use command lines with find
and grep
.
find
is a very powerful tool to find files. Examples:
find / -iname "*autostart*" # to search everywhere
find ~ -iname "*autostart*" # to search in your home directory
Use elevated permissions,
sudo find ...
if there are directories, that you are not allowed to search as a regular user. Seeman find
or a tutorial via the internet to learn more about it.
grep
is a very powerful tool to find text strings in files (search for file content). Examples
grep 'alias' ~/.bashrc
See
man grep
or a tutorial via the internet to learn more about it.
locate
is a fast tool to find files when it has an updated database. Seeman locate
or a tutorial via the internet to learn more about it.
Update the data-base for
locate
with
sudo updatedb
and if it does not include a secondary file system, that is mounted in
/media
, you can edit the configuration file to make it include it (or move the mountpoint to/mnt
, but that may cause problems with hardcoded paths),
cd /etc
sudo cp -p updatedb.conf updatedb.conf.bak
sudo nano updatedb.conf
edited Dec 25 '18 at 6:36
answered Dec 23 '18 at 20:53
sudodussudodus
25.7k33078
25.7k33078
Thank you! I've been usingfind
. I seem to remember not needing to use the optioniname
in the past, bu tseem to need to now; has this changed? Perhaps I should just installRecoll
, but do you know if there is any way to force the GUI tools that come with the system, available at the touch of a button, to index my directories so that I can use them?
– jdc
Dec 24 '18 at 6:20
1
1. You can still use-name
, it makes a difference between upper case and lower case.-iname
will search for both, for example "find -iname "*.jpg" will find jpg files and JPG files; 2. I suggest that you installrecoll
. I don't know if there is a 'default' indexing like in Windows, unless we can consider thatlocate
and its database have that role.
– sudodus
Dec 24 '18 at 6:36
OK, I've installedrecoll
; is there any way to integrate it with the system so I can find files by hitting META and typing like I'm used to?
– jdc
Dec 24 '18 at 7:51
@jdc, Probably, you can do almost everything with linux, but I don't know how to integrate it completely. You could make a desktop icon or try to get it into the dock at the left side. Other people are better at manipulating the desktop environment. You have a better chance to get help, if you create a separate question for that problem: "How to integraterecoll
into the desktop environment to get a quick access to it".
– sudodus
Dec 24 '18 at 11:53
add a comment |
Thank you! I've been usingfind
. I seem to remember not needing to use the optioniname
in the past, bu tseem to need to now; has this changed? Perhaps I should just installRecoll
, but do you know if there is any way to force the GUI tools that come with the system, available at the touch of a button, to index my directories so that I can use them?
– jdc
Dec 24 '18 at 6:20
1
1. You can still use-name
, it makes a difference between upper case and lower case.-iname
will search for both, for example "find -iname "*.jpg" will find jpg files and JPG files; 2. I suggest that you installrecoll
. I don't know if there is a 'default' indexing like in Windows, unless we can consider thatlocate
and its database have that role.
– sudodus
Dec 24 '18 at 6:36
OK, I've installedrecoll
; is there any way to integrate it with the system so I can find files by hitting META and typing like I'm used to?
– jdc
Dec 24 '18 at 7:51
@jdc, Probably, you can do almost everything with linux, but I don't know how to integrate it completely. You could make a desktop icon or try to get it into the dock at the left side. Other people are better at manipulating the desktop environment. You have a better chance to get help, if you create a separate question for that problem: "How to integraterecoll
into the desktop environment to get a quick access to it".
– sudodus
Dec 24 '18 at 11:53
Thank you! I've been using
find
. I seem to remember not needing to use the option iname
in the past, bu tseem to need to now; has this changed? Perhaps I should just install Recoll
, but do you know if there is any way to force the GUI tools that come with the system, available at the touch of a button, to index my directories so that I can use them?– jdc
Dec 24 '18 at 6:20
Thank you! I've been using
find
. I seem to remember not needing to use the option iname
in the past, bu tseem to need to now; has this changed? Perhaps I should just install Recoll
, but do you know if there is any way to force the GUI tools that come with the system, available at the touch of a button, to index my directories so that I can use them?– jdc
Dec 24 '18 at 6:20
1
1
1. You can still use
-name
, it makes a difference between upper case and lower case. -iname
will search for both, for example "find -iname "*.jpg" will find jpg files and JPG files; 2. I suggest that you install recoll
. I don't know if there is a 'default' indexing like in Windows, unless we can consider that locate
and its database have that role.– sudodus
Dec 24 '18 at 6:36
1. You can still use
-name
, it makes a difference between upper case and lower case. -iname
will search for both, for example "find -iname "*.jpg" will find jpg files and JPG files; 2. I suggest that you install recoll
. I don't know if there is a 'default' indexing like in Windows, unless we can consider that locate
and its database have that role.– sudodus
Dec 24 '18 at 6:36
OK, I've installed
recoll
; is there any way to integrate it with the system so I can find files by hitting META and typing like I'm used to?– jdc
Dec 24 '18 at 7:51
OK, I've installed
recoll
; is there any way to integrate it with the system so I can find files by hitting META and typing like I'm used to?– jdc
Dec 24 '18 at 7:51
@jdc, Probably, you can do almost everything with linux, but I don't know how to integrate it completely. You could make a desktop icon or try to get it into the dock at the left side. Other people are better at manipulating the desktop environment. You have a better chance to get help, if you create a separate question for that problem: "How to integrate
recoll
into the desktop environment to get a quick access to it".– sudodus
Dec 24 '18 at 11:53
@jdc, Probably, you can do almost everything with linux, but I don't know how to integrate it completely. You could make a desktop icon or try to get it into the dock at the left side. Other people are better at manipulating the desktop environment. You have a better chance to get help, if you create a separate question for that problem: "How to integrate
recoll
into the desktop environment to get a quick access to it".– sudodus
Dec 24 '18 at 11:53
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1104069%2fsearch-is-useless-how-can-i-force-it-to-index-my-hard-drive-2018%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Could you please expand your question and explain what's going wrong? Which steps did you perform, what was the outcome, and what was the expected result?
– pomsky
Dec 23 '18 at 19:19
I don't know quite how to expand it. I type a phrase which is part of the name of a file I know is within the file system via one of the two search methods, and nothing is returned. The expected result is something I can click to go to my file or the containing folder. The actual result is nothing. The other answers seem to involve installing different utilities on the system. It is possible I have searched poorly. I have ignored this problem for a few days and do not remember what I did then, but I would like to be able to use the native system utilities, assuming they can be made useful.
– jdc
Dec 23 '18 at 19:34
2
Ubuntu 17.10 abandoned Unity in favour of GNOME 3, so the file browser in Bionic Beaver (Ubuntu 18.04) is indeed Nautilus.
– Christophe Strobbe
Dec 23 '18 at 19:34
2
@Chris To be clear, it's been Nautilus for a long time.
– wjandrea
Dec 23 '18 at 21:13
Not sure I understood your issue completely, but it sounds to me like you're missing
tracker
pacakge's functionality. It is not shipped with Bionic by default (see known issues) as it may cause performance issues, especially in systems with low specs.– pomsky
Dec 24 '18 at 7:30