Category: Bash / Terminal / Scripts

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

remote network mount directory via ssh – sshfs

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

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


i want to create a autostart script that starts whenever the server starts. mkdir /scripts vim /scripts/ #!/bin/bash echo „========= starting up docker service“ systemctl start docker echo „========= starting up docker containers“ docker start containername vim /scripts/ #!/bin/bash echo […]


in a script you can specify to save output to a file with current date/time like: LOGFILE=/path/to/logfiles/$(date ‚+%Y-%m-%d‘)_task.log echo „this script was run“ >> $LOGFILE; to cleanup regularly is important in order to ensure the harddisk does not fill up. […]

Windows Batch CMD scripts – why endless loop?

sometimes the scripts that used to work perfectly well – suddenly start to miss behave – but you HAVE NOT altered them! look closely to the directory they reside in… maybe something in the dir has changed! make sure: your […]

linux bash bc – calculating with pi

bc is cool, but it can not access shell variables directly, but you can pass them with <<< also there is no „pi“ constant in bc that you could use in interactive mode. let one assume you would like to […]


display ip and ip only of the host computer the script is running on. ifconfig eth0|grep inet| awk ‚{print $2}‘ | cut -d: -f2 root@debian9:~# IP=$(ifconfig eth0|grep inet| awk ‚{print $2}‘ | cut -d: -f2); echo $IP;


there are some special automatically set environment variabels that might be interesting to know… echo $$; # PID of currently running shell echo $?; # return error code of last run program (before echo) echo $0; # return /path/and/way the […]


vi; # create a new file with those lines #!/bin/bash COUNT=10 while (( COUNT > 0 )) do      echo -e „$COUNT \c“     sleep 1;     (( COUNT — )) done echo -e „\n\nWe have lift off!!“ ESC […]


 stat /etc/hosts   File: ‘/etc/hosts’   Size: 249             Blocks: 8          IO Block: 4096   regular file Device: 801h/2049d      Inode: 5506941     Links: 1 Access: (0644/-rw-r–r–)  Uid: (    0/    root)   Gid: (    0/    root) Access: 2017-06-06 15:37:06.896148382 +0200 Modify: 2017-06-06 15:37:04.728130437 +0200 Change: […]

apt cheat sheed

About: apt is a mainly-online-repository-based („AppStore“) software installation – package management system used by Debian and Ubuntu. But – you can also manually download a package.deb and install it with dpkg -i package.deb. What might be confusing – it consists […]


one practical usage example of xargs: … to process every file that find found further # this would backup/pack all jpg files on your system into all.jpg.tar.gz find / -name „*.jpg“ | xargs tar -czvf all.jpg.tar.gz # delete all jpg […]


what is umask? umask defines what what access rights newly created files „are born“. we are all supposed to be created equal – but depending if you are a son of Rothchild, Rockefeller or born in Namibia – your previleges […]


What is yum? yum is used under CentOS7, Fedora, RedHat RHEL, Oracle). It’s written in python and it stands for “Yellowdog Updater, Modified”, as it was originally called “yup”, the package manager for Yellow Dog Linux. In addition to rpm […]