Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I search through the source code used in Ubuntu?

There is a notification message that I'd like to modify to include more data, but it's not obvious which package it's a part of. But it includes a pretty specific string that would be easy to search on. I know there are a large number of projects included in ubuntu, but I'm hoping there's a good way to find the source when it's not apparent what program is responsible.

share|improve this question
what notification message? – Rinzwind Feb 16 '12 at 15:31
What specifically are you trying to add? What notification message to what part of the OS? – Thomas Ward Feb 16 '12 at 16:30
The notification message is irrelevant. I'm not looking for this particular piece of source code. I'm looking for a general solution this problem in any case. The details are there just to make clear what type of situations I would want to do this in. – Rob Mosher Feb 16 '12 at 16:52
notify-send doesn't work for you ? – warl0ck Jun 10 '12 at 1:14
@warl0ck how would I use notify-send in this case? It seems it creates a notification message, rather than tracking down the source of a message. – Rob Mosher Jun 11 '12 at 15:37

If it's that specific, Google should be able to help you -- it has indexed tons of publicly available source code. I'd be very surprised if it didn't find something.

Failing that (or any other sort of web search), strings is a pretty handy little application. It reads all the strings out of a file, even if it's binary. I've been hacking around and you can use this to find a phrase anywhere on your computer. This version is looking for "bad" in /usr/bin

find /usr/bin -exec bash -c 'if [[ $(strings {} | grep -i bad) ]]; then echo "{}"; fi' \;

That's obviously a pretty hardcore way of doing things. But wait, there's more. You can find the package for each result as you go:

find /usr/bin -exec bash -c 'if [[ $(strings {} | grep -i bad) ]]; then dpkg -S "{}"; fi' \;

Now that's what I call awesome. Here's it in action, looking for "No such device"

oli@bert:/var/log$ find /usr/bin -exec bash -c 'if [[ $(strings {} | grep -i "No such device") ]]; then dpkg -S "{}"; fi' \;
handbrake-gtk: /usr/bin/ghb
usbutils: /usr/bin/usbhid-dump
share|improve this answer

There's an Ubuntu Code Search website that lets you search the source code of all packages in the Ubuntu repositories:

The above site appears to have been down for a while now. I'll try to get in contact with the maintainer.

Edit: I spoke to the maintainer, and this project isn't much of a priority at the moment. I'd recommend using the Debian Code Search instead, as we share a lot of packages/code with them:

share|improve this answer

The answer I know you've been dreading:

Download all the source packages and search them locally. It's about 40 GB, gzipped. I'd start by setting up apt-mirror with only deb-src entries.

share|improve this answer

I know am late but still , the package name is libnotify and the source code for it is here

share|improve this answer

Ubuntu uses the Debian Linux source code. But, you have to know that linux is a kernel (, and a distribution is the software ( bundled with it. You can get the Ubuntu Source repository from You can also refer to

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.