Linux

Debian daemon control

In RedHat distributions like RHEL, Fedora and also CentOS you have a tool called ntsysv to manage daemons and their runlevels. In Debian there is an alternative tool that lets you determine what daemon you want to run using a text GUI sysv-rc-conf It makes it easy to manage which daemons you would like to […]

Read More
Scripting

Grep recursively through subdirectories

grep recursively through subdirectories for files that match a specific pattern: grep -l -r –include=*.doc regex * The equivalent command unsing find: find . -name ‘*.doc’ -exec grep -l regex \{\} \; The option after grep is the lowercase letter L, not the number 1). Remove the -l to see the actual matches instead of […]

Read More
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
Web

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