I have a source tarball: ap-kernelmodule-1.0.14-13.tar.gz I have to compile a kernel module out of it and was instructed to install development tools for my Ubuntu version (which is 12.10). The format is: sudo apt-get install linux-headers-$(uname -r) build-essential

Question #1: what is uname?

(When I installed Ubuntu, I input sharon as my name and which is also my account name. Whenever I open a terminal window, the words sharon@sharon: appear) Based on the format, I should input:

sudo apt-get install linux-headers-$(sharon -r) build-essential


sudo apt-get install linux-headers-$sharon -r build-essential

Question #2: Which of the above is correct?

(I am new to Linux and Ubuntu; hence detailed instructions are appreciated)

  • You'd better put the details from this question to the other similar question you asked. askubuntu.com/questions/232195/how-do-i-compile-kernel-modules – gertvdijk Dec 23 '12 at 23:43
  • Sorry, I didn't mean to spam. I thought making a post for each sub-topic would be clearer. Could you show me how to merge this topic to the other one pointed out by you? Thanks. – n00b Dec 23 '12 at 23:46

Do not copy my commands, you must type them in and use your tab key becuase my kernel may be different than yours. I explain play by play:

Open up a terminal and type:

sudo apt-get update

This update gives your computer a heads up of files you may need. But no files download, only information on what can be downloaded. If you didn't do this first, you may not have the latest link to security updates or the latest versions of software.

As you type, press the tab key, to finish your command. Start typing the command that will install build-essential. Once you get this far stop:

sudo apt-get install linux-headers-

The next part that should appear will be your Linux kernel. So open another terminal and type this:

uname -r

You should see something like this:


Now go back to the other terminal and press tab as type. You should see your kernel pop up. Choose that one.

sudo apt-get install linux-headers-3.2.0-23-generic

Now type a space and add build-essential (don't forget use your tab for completion).

sudo apt-get install linux-headers-3.2.0-23-generic build-essential

Now hit enter and files will download that help you compile code.

  • @ cxx6xxc: Thanks for being an angel. I really appreciate your taking the time to type out such detailed instructions. May you and your loved ones have a Merry Christmas. – n00b Dec 24 '12 at 0:32
  • @ cxx6xxc: Sorry but I don't quite understand what you meant by "As you type, press the tab key, to finish your command." You see, under normal circumstances, when I type, the blinking cursor automatically moves to the right (my language keyboard is US English, so the cursor moves from left to right). – n00b Dec 24 '12 at 0:37
  • @ cxx6xx: Is it OK to open more than one terminal window at the same time? Will opening more than one terminal window at the same time cause Ubuntu to become confused or lead to a crash? – n00b Dec 24 '12 at 0:38
  • The Tab Mystery:bogojoker.com/unix/tricks/autocomplete.html – cxx6xxc Dec 24 '12 at 2:58
  • Ubuntu will not get confused. Ubuntu is just a bunch of files and directories on a storage disk. When one is being accessed to be written, it locked down, so no confusion can happen. Several people reading the same thing can't hurt, everyone just takes turns. All the rest is applications that fill live memory. That can't create confusion because they can't enter each other's space in live memory. Things could get slow, because everyone needs a little push by the processor and there is only so much push per second, but that's it. – cxx6xxc Dec 24 '12 at 3:06

uname is a command which must be entered at the commandline. So if you open a terminal and type uname it outputs the word Linux. In the command you mentioned you find -r. This is an option to uname. It instructs uname to print the kernel release number. So it will basically print out some numbers (like 3.2.0-41-amd64).

You should enter the command

sudo apt-get install linux-headers-$(uname -r) build-essential

like it is written. The $(something) tells your commandline (better word would be shell) to execute the command something and insert the output of that command.

So in your uname case (assuming that the number I wrote is correct, which might not be in your case) the command which is executed is sudo apt-get install linux-headers-3.2.0-41-amd64 build-essential. Basically you could just look for your kernel version and insert it manually.

As you now see none of your versions is correct. The solution looks a bit different.

  • I hope it helped to get your question answered. If yes, please accept it as solution. ;-) – qbi Dec 23 '12 at 23:54
  • Thanks, I believe you have answered my question. So which button should I click to tell the forum that my question has been answered? From where I am right now, there are only 2 buttons: "Add Comment" and "Answer Your Question". – n00b Dec 23 '12 at 23:59
  • On the left hand side there is an up and a down arrow and below you find a check mark (✓). If you click on that you accept an answer as accepted. Please see also the description at askubuntu.com/faq#howtoask – qbi Dec 24 '12 at 0:07
  • @ qbi: Thanks a lot. And a Merry Christmas to you and your loved ones. – n00b Dec 24 '12 at 0:09

Your Answer

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

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