Sign In

    Enjoy FOSSwire's content? Have it delivered! Subscribe

    Find the package a file is from

    A quick tip today for all Debian (and derivative) users:

    Have a file on in your system that you just can’t figure out where it came from? Searching for the name in Synaptic doesn’t help? About ready to heave your weary keyboard out the window in an administrative rage? Fear not, dpkg to the rescue!

    Let’s say you are trying to find out where in the world /usr/share/epiphany-browser/glade/epiphany.glade came into existence. You’ve checked epiphany-browser, but it’s not there. Let’s ask dpkg-query:

    
    $ dpkg-query -S /usr/share/epiphany-browser/glade/epiphany.glade
    epiphany-browser-data: /usr/share/epiphany-browser/glade/epiphany.glade
    
    

    Okay, so it was in epiphany-browser-data. Let’s ask dpkg-query to do the reverse this time, and find all files included in that package:

    
    $ dpkg-query -L epiphany-browser-data
    /usr/share/epiphany-browser
    /usr/share/epiphany-browser/components
    /usr/share/epiphany-browser/components/epiphany.xpt
    /usr/share/epiphany-browser/art
    /usr/share/epiphany-browser/chrome
    # ...
    
    

    A good trick I use instead of remembering dpkg-query switches is to simply add aliases to my .bashrc:

    
    alias dpkgs="dpkg-query -S"
    alias dpkgl="dpkg-query -L"
    
    

    The above example could then be shortened to dpkgl epiphany-browser-data.

    Not all files are managed by packages, and so this may not always get you the results you wanted. Obviously, user-created files in /home will not be from any packages, nor will most files in /etc. But it’s still a handy way to figure out where a file came from.

    In one last example, you can take advantage of shell command nesting to figure out which package contains a binary:

    
    $ dpkg-query -S `which firefox`
    firefox-3.0: /usr/bin/firefox
    
    

    (Those are backticks, by the way, not regular quotes.)


    Quick Tip: Clear Out GNOME Tracker Indexes

    Tracker logo

    If you followed my recent video tutorial on enabling Ubuntu/GNOME’s Tracker search tool, you should now be enjoying the ability to search the files on your system.

    During a recent upgrade to Ubuntu 9.04, which was recently released, I found that the Tracker search tool index had become corrupted. I tried to tell Tracker to rebuild the index, but experienced some weird issues.

    In this quick tip, I’ll show you how to avoid this and other issues by deleting Tracker’s index and cache manually, so that it can start ‘from scratch’. Note that if you are having issues with tracker, it is worth trying to rebuild the index from the graphical interface first. This tip is a last resort if you need to clear everything out from scratch and start it again.

    Tracker’s Files

    According to the documentation, Tracker stores its files in the following locations:

    • Configuration Files – ~/.config/tracker/tracker.cfg
    • Data Files – ~/.local/share/tracker
    • Index Cache – ~/.cache/tracker

    If you’re happy with the settings you have, you may want to leave the configuration file intact, and just wipe out the data files and index cache.

    Quit Tracker and Delete the Files

    First of all, you need to go ahead and quit the Tracker application in the system tray.

    Quit the Tracker tray applet

    Next, you must quit all processes of both trackerd and tracker-indexer, so open up a terminal and run these commands:

    $ killall trackerd
    $ killall tracker-indexer

    And finally, carefully delete the files listed above (excluding the config file, if you don’t think you need to clear that out as well).

    So to recap, go ahead and delete the folders:

    • ~/.local/share/tracker
    • ~/.cache/tracker

    and if you wish, the config files:

    • ~/.config/tracker/tracker.cfg
    • ~/.config/tracker/tracker-applet.cfg

    To restart Tracker, I recommend that you log out and log back in so that trackerd and the system tray applet both restart properly. You should then be able to reconfigure it from the beginning as detailed in the original tutorial.

    And that should be it – Tracker should rebuild itself from scratch. Useful to know for if things go wrong!


    Colour your GRUB boot menu

    That boring white on black GRUB boot menu you get when you switch on your computer is a bit, well, boring, isn't it?

    Thankfully, there's an easy way to change it if you go into your GRUB configuration file. A word of warning, though, editing the GRUB configuration file without knowing what you're doing can result in bad things happening and can cause you to not be able to boot your system. Tread with caution.

    The configuration file will be located at either /boot/grub/menu.lst or /etc/grub.conf. Open it up, as root, in your favourite text editor.

    The line we need to add is the color command. It works like this:

    color normal [highlight]

    The normal colour, is quite obviously, the colour that will be used normally, and the highlight colour will be the colour when that row is selected to show that it is selected.

    For both normal and highlight, though, you can separate the foreground and background colours with a /.

    An example of this is if we wanted the following - the normal colour is cyan on blue, and the highlight is white on blue. The code we'd need is this:

    color cyan/blue white/blue

    According to the relevant GRUB manual page, the available colours you can use are:

    • black

    • blue

    • green

    • cyan

    • red

    • magenta

    • brown

    • light-gray


      These below can be specified only for the foreground.

    • dark-gray

    • light-blue

    • light-green

    • light-cyan

    • light-red

    • light-magenta

    • yellow

    • white

    Once you've got the color command you want, you need to put it somewhere in your GRUB configuration file. Your default colour scheme should be put somewhere near the top of the file and this will be used for all the entries in your boot menu unless you specify otherwise.

    To have custom colours for an individual entry, just place the relevant color command under its title. For example, if I want my Fedora system to have a red and grey theme, I would have this:

    title Fedora release 8 (Werewolf) (on /dev/sdb1)
    color light-gray/red red/light-gray
    root (hd1,0)
    kernel /boot/vmlinuz-2.6.23.1-42.fc8 ro root=/dev/sdb1
    initrd /boot/initrd-2.6.23-1-42.fc8.img
    savedefault
    boot

    And that's about it. Have fun prettifying your boot sequence!


    1. 1
    2. 2