Linux / Windows – what’s the difference…

Bash script to run via command-line to lowercase all file- and folder names in current folder recursively

#!/bin/bash # first, rename all folders for f in `find . -depth ! -name CVS -type d`; do g=`dirname "$f"`/`basename "$f" | tr '[A-Z]' '[a-z]'` if [ "xxx$f" != "xxx$g" ]; then echo "Renaming folder $f" mv -f "$f" "$g" fi done # now, rename all files for f in `find . ! -type d`; […]

How to change Linux files/folders permissions under same directory recursively 644/755

One approach would be: find . -type d -print0 | xargs -0 chmod 0755 find . -type f -print0 | xargs -0 chmod 0644 Other approach: find /full/path/to/your/files -type f -exec chmod 644 {} \; find /full/path/to/your/files -type d -exec chmod 755 {} \; NB! Please do note that -f option is for files and […]

Nifty feature to change text inside large file over Linux commandline

sed -i 's/original/new/g' file.txt sed = Stream EDitor -i = in-place (i.e. save back to the original file) s = the substitute command original = a regular expression describing the word to replace (or just the word itself) new = the text to replace it with g = global (i.e. replace all and not just […]

Letsencrypt on Ubuntu 16.04 LAMP howto commandline

1. Install Letsencrypt with apache addon: sudo apt-get install python-letsencrypt-apache 2. Generate only cert for domain letsencrypt –apache certonly If above fails: 1. For different webroot letsencrypt certonly -a webroot –webroot-path=/var/www/ -d 2. If apache fails or port 443 fails – do manual over HTTP letsencrypt certonly –standalone-supported-challenges http-01 NB! Apache needs fullkeychain and […]

Restoring MySQL root user privileges when corrupt (in linux)

1. On commandline (shut down mysql and start mysqld_safe without grant tables): sudo /etc/init.d/mysql stop sudo mysqld_safe –skip-grant-tables & 2. On new terminal window (log on and execute code as shown): mysql UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root'; FLUSH PRIVILEGES; GRANT ALL ON *.* TO 'root'@'localhost'; FLUSH PRIVILEGES; 3. Kill mysqld_safe instance 4. Log […]

, , , ,

Kuidas kasutada Windows OS’is DIG’i

DIG käsud ja seletused on leitavad lehelt: DIG Windowsile on alla laetav BIND paketi osana lehelt:

Torrentid ja jälgimine

Siinkohal kirjutan enda tarbeks põhiliselt kokkuvõtva teabe P2P võrgu võimalikest “turvavigadest” ja nende “parandamisest”. (Enamus lingid teistele lehtedele või nendel olev teave võib olla natuke vananenud…) Et siis… – enamus inimestest kasutab reeglina P2P networki failide jagamiseks/laadimiseks – suur osa sellest moodustavad torrentid. Viimasel ajal (loe: viimase 3 aasta jooksul) aga on hakatud “tasuta torrent […]

How to reset forgotten WinXP / Win7 / Win8 password and get software serials backup

I’m using 64 bit Win7 Proffessional. 1. You need WinPE disk For that You need:

hg and mercurial on bitbucket – ssh on linux connection problems

FoodForThought: Error: dev$ hg pull remote: Permission denied (publickey). abort: no suitable response from remote hg!

, , ,

IP block from MySQL via iptables

Nifty bash script: #!/bin/bash # 19.09.2013 – Kristjan Tarjus # this script retrieves data from mysql using bash and adds them to iptables for blocking dbase=”YOURDBDATABASE” table=”YOURDBTABLE” host=”YOURDBHOST” user=”YOURDBUSER” dbpass=”YOURDBPASS” #For multiple servers – this script checks via IP function int-ip { /sbin/ifconfig $1 | grep “inet addr” | awk -F: ‘{print $2}’ | awk […]

Previous Posts Next posts