Find and Remove Files from Shell Prompt in Linux

How do I find and delete files under Linux / UNIX? Remove all error.log files from a folder and its subfolders: find /var/www/ -type f -name "error.log" -exec rm -rf {} \; Remove all access.log files from a folder and its subfolders: find /var/www/ -type f -name "access.log" -exec rm -rf {} \; Remove all […]

ISO Download Microsoft Windows 10 Anniversary Update

You can direct download the official (untouched) ISO file for Microsoft Windows 10 Anniversary Update (both 32-bit and 64-bit) from Microsoft website at the following link: Download Windows 10 Disc Image (ISO File) Under “Select edition” just select “Windows 10” and click on “Confirm”. The .ISO files are named respectively: Win10_1607_English_x32.iso Win10_1607_English_x64.iso

Update a WordPress Plugin via UNIX Shell Prompt

Need to update a WordPress plugin via UNIX shell prompt? Open the /wp-content/plugins directory, example: cd /var/www/wpsite.com/htdocs/wp-content/plugins Let’s say you need to update WordPress SEO plugin, type: rm -rf wordpress-seo wget https://downloads.wordpress.org/plugin/wordpress-seo.3.9.zip unzip *.zip rm -f *.zip That’s all!

Update WordPress from UNIX Shell Prompt

Need to update WordPress from UNIX shell prompt? Set the current directory to the root folder of WordPress installation: cd /var/www/wpsite.com/htdocs/ Now type these commands to update WordPress to latest version: rm -rf wp-admin rm -rf wp-includes mv wp-config.php wp-config.bak rm -f *.php mv wp-config.bak wp-config.php wget -O latest.tar.gz https://wordpress.org/latest.tar.gz gunzip latest.tar.gz tar xf latest.tar […]

Disable Plugin and Theme Update and Installation on WordPress

Prevents users from being able to update or install plugins and themes, plus removes the “Editor” menu so users can’t edit files. Add this line to your wp-config.php file: define(‘DISALLOW_FILE_MODS’, true); To allow plugins and themes installation and updates but to disable only the file editor, use this: define(‘DISALLOW_FILE_EDIT’, true);

Google SafeBrowsing v4 PHP Example

Sample PHP function to check Google SafeBrowsing v4 API: function Lookup_GoogleSafeBrowsing_v4($url) { $data = ‘{ "client": { "clientId": "TestClient", "clientVersion": "1.0" }, "threatInfo": { "threatTypes": ["MALWARE", "SOCIAL_ENGINEERING"], "platformTypes": ["LINUX"], "threatEntryTypes": ["URL"], "threatEntries": [ {"url": "’.$url.’"} ] } }’;   $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://safebrowsing.googleapis.com/v4/threatMatches:find?key=ENTER_YOUR_API_KEY_HERE"); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", […]

Change Siteurl with MySQL Queries on WordPress

To change the siteurl of your WordPress site, use these SQL queries: UPDATE wp_options SET option_value = replace(option_value, ‘http://www.oldsite.com’, ‘http://www.newsite.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’; UPDATE wp_posts SET guid = replace(guid, ‘http://www.oldsite.com’, ‘http://www.newsite.com’); UPDATE wp_posts SET post_content = replace(post_content, ‘http://www.oldsite.com’, ‘http://www.newsite.com’); UPDATE wp_postmeta SET meta_value = replace(meta_value, ‘http://www.oldsite.com’, ‘http://www.newsite.com’);

ERROR 1932 (42S02): Table doesn’t exist in engine

The last day I copied all /var/lib/mysql directory to another server to move the database files to a more powerful server. However when I started mysql in the new server and I typed “select * from users” to see if the table was loaded correctly, I received this error: ERROR 1932 (42S02): Table doesn’t exist […]

ERROR 1018 (HY000): Can’t read dir of ‘/dbname/’ (errno: 13)

If you get this error while you try to dump or show tables: ERROR 1018 (HY000): Can’t read dir of ‘/dbname/’ (errno: 13 – Permission denied) Try to change the owner\group to the mysql directory: chown -R mysql:mysql /var/lib/mysql/ Change also the permissions to the mysql directory: chmod -R 755 /var/lib/mysql/ Now it should work, […]