OS Version for Linux

Use the following command

cat /etc/*-release

WD My Cloud Needs This

cat /proc/version

Results as of 2021-10-03

Linux version 3.10.39 (kman@kmachine) (gcc version 4.6.4 (Linaro GCC branch-4.6.4. Marvell GCC Dev 201310-2126.3d181f66 64K MAXPAGESIZE ALIGN) ) #1 SMP Thu Aug 29 19:32:48 PDT 2019 2014T20p4 Build-gita3b74c9

Remote Execution Commands

Here are some of the tools I have used in the pass to do various things. If I have to use something today then that would be SSH and Ansible for any mass operations

For all small jobs I generally go with SSH safe and secure.
Here are some of the examples of how you can put SSH to use. Make sure you setup credential keys for ease.

www.cyberciti.biz/faq/unix-linux-execute-command-using-ssh

www.cyberciti.biz/faq/linux-unix-osx-bsd-ssh-run-command-on-remote-machine-server

Following is the tool that allows you execute commands on multiple hosts. This is Python based.

www.tecmint.com/execute-commands-on-multiple-linux-servers-using-pssh

Ansible:

ansible-tips-and-tricks.readthedocs.io/en/latest/ansible/commands/#running-ad-hoc-commands

On Windows machine I used PowerShell. I find powershell too complicated and cryptic

www.howtogeek.com/117192/how-to-run-powershell-commands-on-remote-computers

On Mar 26, 2014, at 10:17 AM, Bachtel, Michael wrote:

Hi all,

Some of us have had issues with Apache not serving some deployed files.

In short the issue is one with the OS's file context and was fixed by running
$ sudo restorecon -r /opt/<APP_DIR>

Longer version sourced from https://www.centos.org/forums/viewtopic.php?t=6834

"The issue is caused when you mv something from one place to another. It preserves the selinux context of the original when you move it, so if you untar something in /home or /tmp it gets given an selinux context that matches its location. Now you mv that to /var/www/html and it takes the context saying it belongs in /tmp or /home with it and httpd is not allowed by policy to access those files.

If you cp the files instead of mv them, the selinux context gets assigned according to the location you're copying to, not where it's coming from. Running restorecon puts the context back to its default and fixes it too."

~Mike

“Engine X” nginx

Nginx (pronounced "engine x") is an open source reverse proxy server for HTTP, HTTPS, SMTP, POP3, and IMAP protocols, as well as a load balancer, HTTP cache, and a web server (origin server). The nginx project started with a strong focus on high concurrency, high performance and low memory usage. It is licensed under the 2-clause BSD-like license and it runs on Linux, BSD variants, Mac OS X, Solaris, AIX, HP-UX, as well as on other *nix flavors. It also has a proof of concept port for Microsoft Windows.[6]

Unix Nohup: Run a Command or Shell-Script Even after You Logout

When you execute a Unix job in the background ( using &, bg command), and logout from the session, your process will get killed. You can avoid this using several methods — executing the job with nohup, or making it as batch job using at, batch or cron command. This quick tip is for beginners. If you’ve been using nohup for a while, leave us a comment and tell us under what situations you use nohup. In this quick tip, let us review how to make your process running even after you logout, using nohup. Nohup stands for no hang up, which can be executed as shown below.

nohup syntax: $nohup command-with-options &

Rewrite Rules

Encode/Decode Online Tool
http://urldecoder.waraxe.us

Strip Unwanted Query String
https://sites.google.com/site/onlyvalidation/page/strip-unwanted-query-string-apache

RewriteCond %{QUERY_STRING} (^|&)doing_wp_cron= [NC,OR]
RewriteCond %{QUERY_STRING} (^|&)refsite= [NC]
RewriteRule (.*) /$1? [R=301,L]

Blacklist via Request URI - Did NOT Work
http://perishablepress.com/eight-ways-to-blacklist-with-apaches-mod_rewrite/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^.*(,|;|:|<|>|">|"<|/|\\\.\.\\).* [NC,OR]
RewriteCond %{REQUEST_URI} ^.*(\=|\@|\[|\]|\^|\`|\{|\}|\~).* [NC,OR]
RewriteCond %{REQUEST_URI} ^.*(\'|%0A|%0D|%27|%3C|%3E|%00).* [NC]
RewriteRule ^(.*)$ - [F,L]
</IfModule>

rsync example

Notice that the target folder does not have a trailing slash, and this example is used to keep the same structure starting at the folder-unique down.

You will need to tar the files or copy to a USB formatted as EXT3/4 to preserve the file permissions

rsync -vca --delete /my/source/folder-unique/ /my/target/folder-unique

Trying different way to preserve permissions for git - FAIL !!!

Refer: https://bobcares.com/blog/how-to-preserve-permissions-in-rsync/

rsync -avz --delete /my/source/folder-unique/ /my/target/folder-unique