How can I search the ubuntu source code?

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.

5

5 Answers

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

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:

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.

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

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 archive.ubuntu.com. You can also refer to

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like