Browsed by
Category: Bash

[Bash] Script for monitoring content of website

[Bash] Script for monitoring content of website

Imagine that you are waiting for marks from exam. Lecturer is going to publish them on his website, but you don’t know when. I’ve created following script, because I don’t like pressing F5 for hours 🙂 You have to provide address of website, and if website changes, script will open firefox and show notification. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 #!/bin/sh # Wojtek Jamrozy www.wojtekrj.net   if […

Read More Read More

[Bash,Linux] Very fast disk shredding/data erasure script

[Bash,Linux] Very fast disk shredding/data erasure script

Before I have setted up my encrypted partitions I had to fill them with random sequention of data. I’ve noticed that dd if=/dev/urandom of=DEVICE is very slow. It has 3-4 MB/second on my computer. I wanted to make it faster. Here is my solution: 1. Create in tmpfs located in RAM memory large file (about 100 MB) made of pseudo-random sequence (/dev/urandom). 2. Write this file from memory sequentially to the disk. Speed of this approach is even 34 MB/s…

Read More Read More

[Linux] Random password generator

[Linux] Random password generator

Here is a script for generating random alphanumeric passwords: #!/bin/bash # passwords.sh if [ $# != 2 ]; then echo "usage: $0 <length of passwords> <number of passwords> " exit 1 fi tr -cd ‘[:graph:]’ < /dev/urandom | fold -w $1 | head -$2#!/bin/bash # passwords.sh if [ $# != 2 ]; then echo "usage: $0 <length of passwords> <number of passwords> " exit 1 fi tr -cd ‘[:graph:]’ < /dev/urandom | fold -w $1 | head -$2

[Bash] How to show information about dd progress / statistics

[Bash] How to show information about dd progress / statistics

dd is a great tool for low-level copying and conversion of raw data. It can be also used for data erasure. Unfortunately, it doesn’t show any information about progress of copying. Here is my little, but useful script: 1 2 3 4 5 6 7 8 9 10 #!/bin/bash # dd.sh Author: Wojtek Jamrozy (www.wojtekrj.net)   dd $* & pid=$! sleep 10   while [ -e "/proc/$pid" ] ; do kill -USR1 $pid sleep 10 done#!/bin/bash # dd.sh Author: Wojtek…

Read More Read More

[Ubuntu] Packages auto-purging script

[Ubuntu] Packages auto-purging script

Here is my script for auto-purging of removed packages (the script deletes remaining configuration files of package) in Ubuntu: #!/bin/sh for i in `dpkg -l | grep ^rc | cut -f 3 -d ‘ ‘` do dpkg -P $i; done#!/bin/sh for i in `dpkg -l | grep ^rc | cut -f 3 -d ‘ ‘` do dpkg -P $i; done