What does linux-headers-`uname -r` do?
--reinstall install
:
Normally, this is written install --reinstall
, but both work just fine. This simply is telling apt-get
to reinstall the package(s).
linux-headers-
:
linux-headers-
is the beginning of a package name. If you run dpkg -l | grep linux-headers-
you can see a full list of any packages installed that begin with that:
Header files are, from the GNU site:
A header file is a file containing C declarations and macro definitions to be shared between several source files. You request the use of a header file in your program by including it, with the C preprocessing directive ‘#include’.
And, as you can see from the response from dpkg -l | grep linux-headers-
, the packages that start with linux-headers-
are the header files for the Linux kernel.
`uname -r`
:
This is what is known as Command Substitution. (The link is to the faqs.org page about the BASH command substitution capabilities.)
This runs the uname -r
command, which returns the current kernel version:
and then puts what is returned from the uname -r
command into the sudo apt-get --reinstall install linux-headers-`uname -r`
command.
From the faqs.org page:
Command substitution allows the output of a command to replace the command itself. Command substitution occurs when a command is enclosed as follows:
$(command)
or
`command`
Bash performs the expansion by executing command and replacing the command substitution with the standard output of the command, with any trailing newlines deleted.
Also, see this Unix/Linux Q/A about understand BASH backticks.
Now, you don't see this happen - you just see the results. However, if you did see the command after the uname -r
response was put into the command, this is somewhat it would look like (changing for your current kernel version obviously):
sudo apt-get --reinstall install linux-headers-3.16.0-31-generic
Simplified version:
You're telling apt-get to reinstall the linux-headers package for your current kernel version.