How To Reinstall WordPress ?

The following commands will safely reinstall WordPress after creating a backup of the existing installation.
replace latest.tar.gz with the correct tar.gz for the version of WordPress you are reinstalling. This can be determined by viewing the contents of yoursite/wp-includes/version.php. You can find older versions in wordpress archive at https://wordpress.org/download/release-archive/. Simply copy the URL of tar.gz (e.g. https://wordpress.org/wordpress-4.7.tar.gz) that you need and replace latest.tar.gz with that URL below.

IMPORTANT: Make sure you are in the WordPress directory when running these commands! You should see the usual structure; wp-admin, wp-content, wp-includes, etc.

wget https://wordpress.org/latest.tar.gz
tar xfz latest.tar.gz
mv ./wp-includes ./wp-includes.backup
mv ./wp-admin ./wp-admin.backup 
cd wordpress/
yes | cp -R * ../
cd ..
rm -rf ./wordpress/ latest.tar.gz

Make sure to fix permissions of all files which you have replaced.