Scripting

Rename files in folder

Oneliner to rename files/directories. It converts ” ” into “_” and the characters to lower-case. $> perl -e ‘while(< *>) { $old=$_; s/ +/_/g; rename($old,lc($_)); }’ To limit it to a single filetype use it this way and replace ”.doc” with whatever you like. $> perl -e ‘while(< *.doc>) { $old=$_; s/ +/_/g; rename($old,lc($_)); }’

Read More
Scripting

Updating WordPress using a bash script

If you have shell access to your webserver this script can be used to upgrade your WordPress installation to the latest version quickly. Always remeber to backup your database and installation files before running it! Do change the bold text to reflect your WordPress Internet address before you run the script. #!/bin/bash CURDIR=$(pwd) SITE=”http://yoursite.com/wordpress” echo […]

Read More
Network

Using TCP Wrappers to deny daemon access in specified hours

By doing the following you can deny certain daemons to be available in specified hours by using hosts.allow and hosts.deny. In my example I will be using the vsftpd daemon by adding tcp_wrapper=YES in /etc/vsftpd.conf. Make sure that your private network has access all the time by adding this in /etc/hosts.allow vsftpd: 192.168.0. Enables access […]

Read More