Category: Bash / Terminal / Scripts

gnu linux bash – ssh login as different user

situation: one is userA but wants to ssh login to server with ipv4: 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 […]


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 […]


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 […]


update: safety first! when it comes to important files: safety comes first thus recommend to the user that wants to go pro the following backup system: have two complete backups at two different places: backupA: at the company, USB 3.0 […]


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) […]


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 Tue […]

linux bash – show all crontabs of all users

cat /scripts/ 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

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

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

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

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/ cat /scripts/ #!/bin/bash # ping -c […]