Category: Bash / Terminal / Scripts

06.03.2020

hostnamectl; # tested on Icon name: computer-desktop Chassis: desktop Operating System: Debian GNU/Linux 10 (buster) Kernel: Linux 4.19.0-8-amd64 Architecture: x86-64 su – root; # become root apt update apt install rfkill rfkill list all 0: phy0: Wireless LAN Soft blocked: […]

the second nftables howto – it is fast and …… complicated
12.01.2020

firewall & pinguin: iptables where do thou go? it is said that when using “ip-sets” iptables and nftables achieve almost same performance (amounts of ips possible to block, without server becoming slow/unresponsive) Redhat and nftables on DDoS “so the only […]

gnu linux bash – ssh login as different user
12.01.2020

situation: one is userA but wants to ssh login to server with ipv4: 123.123.123.123 via userB (dedicated user for that server/task). so what one does is: make sure one can login as userB than as userA: userA: ssh -v -i […]

10.01.2020

mdadm -E /dev/sd[a-z] # -E, –examine # Print contents of the metadata stored on the named device(s). # Note the contrast between –examine and –detail. # –examine applies to devices which are components of an array, while # –detail applies […]

09.09.2019

yum install ascii # or apt install ascii ascii Usage: ascii [-dxohv] [-t] [char-alias…] -t = one-line output -d = Decimal table -o = octal table -x = hex table -h = This help screen -v = version information Prints […]

29.08.2019

when one is happy with the setup of a linux system (config and scripts) one might want to backup those settings and restore it on a different machine or if things go haywire restore on the current machine. cat /scripts/backup/config_scripts.sh […]

05.06.2019

WARNING! BE VERY VERY CAREFUL! YOU CAN DESTROY YOUR SYSTEM! so better use a system that is not production important/not a live server. use a laptop that has NOTHING ATTACHED TO IT! (unplug all USB Sticks and external USB Drives) […]

15.05.2019

will do exactly that: last -F # -F Print full login and logout times and dates. # output will look like this # username (who logged in) ip (from which was logged in) duration of session username pts/0 123.123.123.123 Tue […]

linux bash – show all crontabs of all users
14.05.2019

cat /scripts/crontab_show_all.sh for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done outputs a nice list like this: in format: user command root no crontab for root actualuser * * * * * echo “stuff” […]

linux bash arrays example
09.04.2019

arrays are pretty useful variables that hold key:value data pairs, per default the “key” is an integer number, BUT: as shown there can also be associative arrays, meaning the index can be any string (needs bash version4) this script demonstrates […]

self hosted wordpress setup script
07.02.2019

WARNING! BACKUP YOUR MACHINE! UNTESTED! before running this script change to your new web root: /home/UserName/web/domain.com/public_html then run it like /scripts/install_wordpress.sh it tries to: download and unpack the latest wordpress into the current directory disable xmlrpc.php disable wp-cron.php requirements: a […]

remote network mount directory via ssh – sshfs
04.02.2019

it is super slow, but for copying small files it works. if /mnt/cifs/here is owned by non-root user, also non-root users are allowed to mount. (which is rather tricky with mount cifs) # setup software apt install sshfs yum install […]

linux bash script – test if host is alive – internet connection test script – uptime test script
15.12.2018

tested with: tested with/on: Static hostname: CentOS1.localdomain Operating System: CentOS Linux 7 (Core) Kernel: Linux 4.15.9 Architecture: x86-64 bash -version GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu) ping -V ping utility, iputils-s20160308 usage: /scripts/count_host_uptime.sh domain.com cat /scripts/count_host_uptime.sh domain.com #!/bin/bash # ping -c […]