File searching

Quick to answer questions about finding your way around Linux Mint as a new user.
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. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
mattrixx
Level 3
Level 3
Posts: 130
Joined: Sat Apr 07, 2007 6:42 pm

File searching

Post by mattrixx »

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
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Husse

Post by Husse »

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
mattrixx
Level 3
Level 3
Posts: 130
Joined: Sat Apr 07, 2007 6:42 pm

Post by mattrixx »

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
scorp123
Level 8
Level 8
Posts: 2272
Joined: Sat Dec 02, 2006 4:19 pm
Location: Switzerland

Post by scorp123 »

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.
mattrixx
Level 3
Level 3
Posts: 130
Joined: Sat Apr 07, 2007 6:42 pm

Post by mattrixx »

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
Locked

Return to “Beginner Questions”