Category: Bash / Terminal / Scripts

12.10.2016

from recording a webradio i had a load of those files, which were kind of tricky to delete. The trick is to use find instead of rm. find -name "*————— – —————*"; #dry run ./————— – ————— (20).aac ./————— – […]

27.08.2016

you can either use wget to download the webpage or use Firefox Ctrl+S (Save As) wget http://domain.com/website.html; # download webpage # become root sudo bash; # or su; apt-get update; apt-get install lynx; lynx -dump "website.html" | awk ‚/http/{print $2}’| […]

03.08.2016

sudo bash; # become root #create directories mkdir -p /backup/mysql # backup every database manually separately mysqldump -u root DATABASE_NAME > /backup/DATABASE_NAME.sql; # backup every database separately automatically (easier to restore) for db in $(mysql -u root -e ’show databases‘ […]

02.08.2016

apt-cache showpkg evolution-common Package: evolution-common Versions: 3.12.9~git20141130.241663-1 (/var/lib/apt/lists/ftp.uni-erlangen.de_debian_dists_jessie_main_binary-i386_Packages) (/var/lib/dpkg/status) Description Language: File: /var/lib/apt/lists/ftp.uni-erlangen.de_debian_dists_jessie_main_binary-i386_Packages MD5: 63a9c80d6efb5e50b74aae7ebcc8bf5c Description Language: en File: /var/lib/apt/lists/ftp.uni-erlangen.de_debian_dists_jessie_main_i18n_Translation-en MD5: 63a9c80d6efb5e50b74aae7ebcc8bf5c Reverse Depends: gnome-panel,evolution-common 3.4.3 evolution,evolution-common 2.91 evolution,evolution-common 3.12.9~git20141130.241663-1 almanah,evolution-common 3.6.0 Dependencies: 3.12.9~git20141130.241663-1 – dconf-gsettings-backend (16 (null)) gsettings-backend (0 […]

21.08.2015

UNTESTED! backup.sh #!/bin/bash PROJECT=domain.com DBUSR=UserNameThatIsAllowedToUseMYSQLDUMP DBNAME=NameOfDatabaseOfProject echo "========= backup database – you will have to provide the password manually" mysqldump -u "$DBUSR" -p "$DBNAME" > /var/www/vhosts/"$PROJECT"/httpdocs/"$DBNAME".sql gzip /var/www/vhosts/"$PROJECT"/httpdocs/"$DBNAME".sql; echo "============== backing up "$PROJECT tar fcvvvz /var/www/vhosts/"$PROJECT"/backups/"$PROJECT"_files_backup_$(date +%Y-%m-%d-%M).tar.gz /var/www/vhosts/"$PROJECT"/httpdocs # remove […]

12.06.2015

this kind of content-search might take a while, because it searches EVERY file. # qnap (busybox) tested/approved su; # become root cd /; # go to root directory # start search in all files find . -type f | xargs […]

23.03.2015

to modify the timeout (make boot faster) on newer linux tested on : (# Debian 8 „Jessie“ Linux DebianGiada 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt7-1 (2015-03-01) x86_64 GNU/Linux): edit this config file: vim /etc/default/grub # modify 1 = wait 1 second […]