Accidentally deleted /usr/include , how to recover?

So , I wanted to add .h files to include , got confused and put in the /usr/include there were many files …so i deleted them all. I know it was a real stupid move.
But is there a way now?
My VSCode isn’t working now…
Not even Python.

Even if it Requires re-installation, I am okay with it.

My system has UEFI mode, Fedora in dual boot with Windows 10. Already have flash usb.

4 Likes

As you can see…these are my following partitions,
So guide me with SDXn where Xn is a,b (1,2,3,etc)

Nice approach :+1:, only one suggestion I would make, to add sort -u, like this:
sudo dnf reinstall $(rpm -q -f $(rpm -q -a -l | grep -e ^/usr/include) | sort -u)

Edit
Missing pipe added

1 Like

Do I need to make a Bash script of this?
And what would it be changing? Like deleting my whole /home or something?

Error:
rpm : -u : unknown option
Usage …
dnf reinstall : error : the following arguments are required : PACKAGE

Sorry forgot a pipe

sudo dnf reinstall $(rpm -q -f $(rpm -q -a -l | grep -e ^/usr/include) | sort -u)

I did and it showed this error : -u unknown option
Error : missing argument : PACKAGE

Works for me.

2 Likes
sudo dnf upgrade
sudo dnf reinstall \
$(rpm -q -f $(rpm -q -a -l | grep -e ^/usr/include) | sort -u)
8 Likes

Thanks a lot @huben @vgaetera
You guys helped a lot!
Else I was about to reinstall Fedora…

Yes, I happen to miss ‘|’ pipe before sort.
It really worked.
May God Bless You Guys

4 Likes

Thanks to @vgaetera.
A very nice solution btw.
Yet again learned sth.

3 Likes

Why did you delete the post?

I take your Point!

With dnf’s repoquery sub-command, it would look like this:

sudo dnf reinstall \
  $(sudo dnf repoquery --installed --whatprovides /usr/include,/usr/include/\*)
5 Likes

Even better and faster. Never used dnf this way. Thanks for sharing. :+1: :slight_smile:

1 Like