File searching

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

File searching

Postby mattrixx on Thu Oct 11, 2007 1:08 pm

I am a windows user trying to switch to and understand linux. In windows there is a search function where I can type in a file name and then find the exact folder location on the system. How can I do that in Celena?

thanks,

Matt
mattrixx
Level 2
Level 2
 
Posts: 72
Joined: Sat Apr 07, 2007 6:42 pm

Linux Mint is funded by ads and donations.
 

Postby Husse on Thu Oct 11, 2007 1:41 pm

There are two basic methods, both from the terminal and both much faster than in windows.
This is one method
Code: Select all
Find all files in the /home partition that begin with the name "Husse...." and print all positive hits:
Code:
find /home -name Husse* -print

note that here husse and Husse are not the same
The method I prefer is to use locate
First update locate's database
Code: Select all
sudo updatedb

This is only necessary the first time and then if you want to search for "new" files
Then
Code: Select all
[code]locate -i your_searchstring[/code]

The -i makes it case insensitive
It looks for every file with your_searchstring in it - i.e. it has wildcards on each side
Very fast
You may get a very large number of hits
Then
Code: Select all
locate -i your_searchstring | less

helps (or you could actually use more)
The | is a vertical line which is found on various locations on your keyboard depending on the layout
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19714
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Postby mattrixx on Thu Oct 11, 2007 2:41 pm

Great, thanks Husse :)

So, I take it there is NO Mint Celena provided "GUI" to accomplish this,
but rather a search of this kind must be done in console mode?

I`m specifically interested in finding out just exactly *where* a Program
(and associated files) that I have downloaded and installed
(using Synaptic Package Management) actually ends up being physically located on the system.

Thanks again,
Matt
mattrixx
Level 2
Level 2
 
Posts: 72
Joined: Sat Apr 07, 2007 6:42 pm

Postby scorp123 on Thu Oct 11, 2007 3:41 pm

mattrixx wrote: (and associated files) that I have downloaded and installed (using Synaptic Package Management) actually ends up being physically located on the system.
Well, if that is all you want then why not ask 'dpkg' (Synaptic is just a front-end to 'apt' and 'dpkg'...)?
Code: Select all
dpkg -L NameOfPackage


Example: dpkg -L fortune-mod ... gives:
Code: Select all
/.
/usr
/usr/games
/usr/games/fortune
/usr/bin
/usr/bin/strfile
/usr/bin/unstr
/usr/share
/usr/share/man
/usr/share/man/man6
/usr/share/man/man6/fortune.6.gz
/usr/share/man/man1
/usr/share/man/man1/strfile.1.gz
/usr/share/doc
/usr/share/doc/fortune-mod
/usr/share/doc/fortune-mod/README.Debian
/usr/share/doc/fortune-mod/copyright
/usr/share/doc/fortune-mod/changelog.gz
/usr/share/doc/fortune-mod/README.gz
/usr/share/doc/fortune-mod/changelog.Debian.gz
/usr/share/menu
/usr/share/menu/fortune-mod
/usr/share/man/man1/unstr.1.gz


Besides: You usually don't even need to know *where* a program is. You just type its name into a shell and Linux should find it right away, regardless where exactly it was installed. Most stuff (but not everything) ends up in /usr/bin anyway ....

And even if you don't remember the name of the package anymore ... ask the apropos command. Let's suppose you forgot the exact name of the package ... but you remember it had something to do with music ... So let's ask 'apropos' about this topic!
Code: Select all
apropos music
... Gives:
Code: Select all
rhythmbox (1)        - music player and library for tagged files using GStreamer
SDL::Music (3pm)     - a perl extension
sonata (1)           - GTK+ client for the Music Player Daemon
The column on the left shows the name of the package (which you would need as argument for the above 'dpkg' command). The number in the brackets shows in which chapter the manual can be found (e.g. man 1 sonata will give you sonata's manual ...) Not happy with the results? Try a different search then:
Code: Select all
apropos mp3
... gives:
Code: Select all
lame (1)             - create mp3 audio files
mp3-decoder (1)      - Free clone of mpg123, a command-line mp3 player
mpg123 (1)           - Free clone of mpg123, a command-line mp3 player
mpg321 (1)           - Free clone of mpg123, a command-line mp3 player
streamripper (1)     - rip shoutcast radio streams to mp3 files
tagmp3 (1)           - manipulate ID3v1 tags


Usually the combo with 'apropos' and 'dpkg' are waaaaaay faster than searching your entire system via 'find' or similar commands. Of course: 'dpkg' will only work if you installed your program via 'apt' or its GUI-frontend 'Synaptic' ... it has no knowledge about programs that you manually installed via other methods.

BTW, all of the above (finding a package, listing its contents ...) can also be done in Synaptic if you're more comfortable with a GUI.
User avatar
scorp123
Level 8
Level 8
 
Posts: 2287
Joined: Sat Dec 02, 2006 4:19 pm
Location: Switzerland

Postby mattrixx on Thu Oct 11, 2007 4:04 pm

Great, this is exactly what I wanted to know :!: Thanks, scorp123 :D

I will definetly print this out and keep /use for a handy reference!

Thanks,
Matt
mattrixx
Level 2
Level 2
 
Posts: 72
Joined: Sat Apr 07, 2007 6:42 pm


Return to Newbie Questions

Who is online

Users browsing this forum: digimonmikujapan, Google [Bot], Yahoo [Bot] and 37 guests