some jpgs are badly compressed, taking 5-10MBytes each! a little nifty cool tool let’s you batch recompress WARNING! Always test things out before applying it to your original data! # become root su – root # install jpegoptim apt install […]
list all current ips that are connected to port 587 netstat -anp | grep :587 | grep ESTABLISHED
One way to do it is: while read p; do echo “$p” done <peptides.txt As pointed out in the comments, this has the side effects of trimming leading whitespace, interpretting backslash sequences, and skipping the trailing line if it’s missing […]
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 […]
# tested on yum install inxi inxi -b System: Host: hp.centos Kernel: 5.1.15 x86_64 bits: 64 Desktop: MATE 1.16.2 Distro: CentOS Linux release 7.6.1810 (Core) Machine: Type: Server System: HP product: ProLiant DL360 G6 v: N/A serial: XXXXXXXXX Mobo: N/A […]
bc is a nice calculator that one can use under linux terminal. a good exercise: count from 0 to 255 and convert it to binary # install # debian/ubuntu apt install bc # fedora/redhat/centos yum install bc # run bc […]
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 […]
this is, because this is, because, when one logs in, and opens another shell as the same user, the last bash process to quit, will save to ~/.bash_history overwrite history. to avoid this add: (TEST IN PROGRESS (UNTESTED)!) # Avoid […]
it is actually possible to open a text file in less, then switch over to vim (without exiting less) and when done with editing, switch back to less. less /open/this/file/for/viewing # switch over to vim :v # now one is […]
tar gz (single core) -> tar pigz (multi core) tar might be old, but still a great program for archiving files manpage: tar.man.txt to get multi core usage for compression (faster) the user tells tar to use a different compression […]
especially in times of EU-GDPR–DSGVO but also for the user’s privacy effectively shredding data is important. if the admin-user wants to wipe-shred-secure-delete entire harddisks look at this article. GNU Linux Debian 10 can do that 🙂 # install software # […]
if you want to search all files (file size smaller than 256MBytes) for a match in it’s sha1 checksum: #!/bin/bash find / -type f -size -256M | while read fname; do checksum=$(sha1sum “$fname”); CHECKSUM=${checksum^^}; echo $CHECKSUM; done write it to […]
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 123.123.123.123 Tue […]
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” […]
aim: in software development, step debugging is a very nice way to look at your code and see if it does what it should. i wondered, if such a thing exists for shell / bash scripts. develop shell bash scripts […]
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 […]
bash games – no kidding! bash is a serious language 😀😎👍⭐⭐⭐⭐⭐❤️☕ while it might not be your first choice when it comes to creating games. it’s awesome what people put together on the command line! bash tetris – works FLAWLESS […]
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 […]
the best about samba: thanks for samba, it provides users with a fast (of course depends also on harddisk speed) rock-solid no-limit-to-maximum-users file-server for maximum file-transfer-and-sharing-and-storage productivity (and they will USE that T: temp drive for EVERYTHING! prepare for TERRABYTES […]
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 […]
start a second console and as root: watch kill -USR1 $(pgrep ^dd)
unfortunately are the tools under the differen UNIXes not standardized. (busybox for example comes with very reduced parameters you can pass to commands) linux: bash terminal one liner # last modified/created file find . -type f -printf ‘%T@ %p\n’ | […]
it is not possible to change uuid of a swap partition with tune2fs, because it only supports ext3/ext4. you will have to recreate it and pass the uuid during creation, which is not a problem because usually swap SHOULD not […]
Linux is pretty hardware independent, so most of the time you can just 1:1 clone/move harddisk to new machine and in 99% of cases it will just boot. make sure – target (new) machine’s harddisk is same or bigger size […]
i want to create a autostart script that starts whenever the server starts. mkdir /scripts vim /scripts/start.sh #!/bin/bash echo “========= starting up docker service” systemctl start docker echo “========= starting up docker containers” docker start containername vim /scripts/stop.sh #!/bin/bash echo […]
You probably now that Stephen Hawking (never got a Nobel Price) was on BigBang A LOT. And he writes to speech synthesis and eye-tracker. And he is giving hilarious funny interviews with this thing DECtalk DTC01… While also saying that AI […]
update: 2019-02: everything was fine… until you decided to update because of the EthernalBlue exploit THAT ALSO AFFECTS OPEN SOURCE IMPLEMENTATIONS OF SMB 1.0! (WTF!? WHY?), samba now miss behaves on Debian and CentOS. (scroll down for details) EternalBlue, sometimes […]
1. install ffmpeg or avconv (debian alternative) 2. put all *.ts* files in one folder (they should have the same encoding, resolution etc. etc.) 3. and while you are in this directory fire this line: ffmpeg -i “concat:$(ls -1 *.ts* […]
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. […]