I do need some help…
I accidentally deleted (time pressure…) the whole “include” dir. via terminal (sudo su …).
How to recover it?
PS: Is there something similar to the “Linux Mint” suggestion below?
sudo apt-get install dlocate
#list the packages
dlocate --package-only /usr/include
sudo apt-get install --reinstall $(dlocate --package-only /usr/include)
I’ve reformatted your post for better readability. Please use the </> button next time to format terminal output/commands.
To get a list of all packages packages with contents in
$ pacman -Qoq /usr/include/
On my system the list is quite long (815 packges).
To reinstall all explicitly installed packages with contents in
$ comm -1 -2 <(pacman -Qeq | sort) <(pacman -Qoq /usr/include/ | sort) | sudo pacman -S -
To get a list of all packages installed as a dependency with contents in
$ comm -1 -2 <(pacman -Qdq | sort) <(pacman -Qoq /usr/include/ | sort) | sudo pacman -S --asdeps -
You’d have to filter out
AUR packages before piping into
sudo pacman ... - it won’t continue but complain about
target not found.
Thank you for the prompt reply.
Actually, I removed firefox (since Im using vivaldi).
As I checked firefox and mozilla, I found and removed:
(1) # rm -r /home/.../.cache/mozilla
(2) # rm -r /usr/include/mozjs-78 (/mozilla)
(3) Accidentally, I pressed "PgUp" and return on # rm -r /usr/include
(should be # ls -l /usr/include).
The goal was to remove unneeded files and applications and provide more space.
How badly do I need the "include"-files?
How to install only the "include"-files the system really need/use?
From what I know - you don’t need them at all.
when some software you want to install needs to be compiled from source.
That is only the case for AUR packages - but not for all of them.
And it might be needed when you want to compile some software that is not in the AUR.
And /usr/include/linux/… might be needed when you use DKMS to (re)build some kernel modules when the kernel version changes.
@freggel.doe told you how you can reinstall all those packages
so that the /usr/include/… that they provide is restored.
If you don’t do any compiling, you don’t really need all that.
It will “fix itself” over time when new versions (updates) are installed.
There is no way to install only the include files - since they are not packaged separately but are part of each programs package.
… delete a part → reinstall the whole and you’ll get the now missing part back as well
An exception might be the linux header files which are a package of their own.
But as already said: you don’t really need or use any of these if you are not compiling anything from source
so nothing is really broken and in need of fixing in that case.
A rather rare case when accidentally deleting system files does not necessarily lead to immediate breakage.
How bad do you need disk space to delete this system folder (or part of its content)? On my system it is around 250MB to 300MB.
Also you should add aliases to add the interactive switch to
mv command so in the future you would need to confirm.
alias rm="rm -i"
alias mv="mv -i"
Solution: Don’t fix. Do restore from snapshot
DONE! It is working... Thank you all.
PS: The aliases are a good idea... ;-)