Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

When I uncompress the Linux kernel source code from Kernel.org, there are many folders. I know what most of them contain and their purpose. However, I cannot figure out or find on the Internet the purpose for the tools and samples directories. What are these two directories and what is their purpose?

share|improve this question
Uncompressing the kernel sources would leave you with a single non-compressed tar file. You probably meant you extracted the sources from the compressed tar. – Anthon Jun 8 '13 at 16:56
Yes Anthon, you are right. – Devyn Collier Johnson Jun 8 '13 at 18:07
up vote 1 down vote accepted

I just uncompressed a kernel and this is what I make of it:

  • For the samples directory, it's showing various examples of kernel modules people might want to develop. Here's a comment from kprobe_example.c:

Here's a sample kernel module showing the use of kprobes to dump a stack trace and selected registers when do_fork() is called.

and from uhid_example.c:

The code may be used by anyone for any purpose, and can serve as a starting point for developing applications using uhid.

etc, etc. Basically, anytime they felt a subject needed an illustration they wrote illustrative code and put it somewhere in this part of the directory tree.

  • For the tools directory: This looks like a directory tree housing linux-specific executables. The bulk of a GNU/Linux platform's userland consists of cross-platform tools or tools created outside the Linux Foundation but occasionally the maintainers know there needs to be a userland tool in order to take advantage of features specific to the Linux kernel. The comments on most seem to include the word "simple" a lot which leads me to believe this directory tree is basically a userland equivalent of the samples directory. This is also because it doesn't look like util-linux comes from this (even though util-Linux does come from the Linux Foundation and kernel.org as well).
share|improve this answer
Thank you. That answers my question very well. – Devyn Collier Johnson Jun 8 '13 at 18:47

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.