Archive for the ‘Linux Administration’ Category.
January 12, 2010, 4:32 pm
$ openssl genrsa -out ca.key 1024
$ openssl req -new -key ca.key -out ca.csr
$ openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
For the explanation, here’s the source: OpenSSL: How To Create Self-Signed Certificate
December 18, 2009, 8:29 pm
$ awksqldump dbname.dump.sql tblname
#!/bin/bash
### check parameter
E_NO_ARGS=65
if [ $# -eq 2 ]
then
# Outputs string of specified table only
awk "/Table structure for table .$2./,/UNLOCK TABLES/{print}" $1 > $1.EXTRACTED.sql
elif [ $# -eq 3 ]
then
# Outputs string starting from table1 and ends on beginning of table2
awk "/Table structure for table .$2./,/Table structure for table .$3./{print}" $1 > $1.EXTRACTED.sql
else
echo "Awk Sql Dump
Usage: awksqldump dumpfilename tablename1 [tablename2]
"
exit $E_NO_ARGS
fi
October 19, 2009, 8:25 pm
October 16, 2009, 11:12 am
rsync -avz -e ssh root@i095.indigo.fastwebserver.de:/var/www/vhosts/philippinedev.com/httpdocs/ /srv/www/vhosts/philippinedev.com/httpdocs/
September 29, 2009, 8:20 pm
DirectoryIndex alternative-default-home-page.php
September 4, 2009, 7:34 pm
<?php
$result = exec('traceroute ' . $_SERVER["REMOTE_ADDR"], $lines);
echo '<h1>Your IP is ' . $_SERVER["REMOTE_ADDR"] . '</h1>';
echo '<pre>';
foreach ($lines as $n => $line) {
if ($n) echo '<br />';
echo $line;
}
echo '</pre>';
echo '<p>-end-</p>';
Here’s how the resulting page looks like: reverse-traceroute.php
January 5, 2009, 5:48 pm
RedirectMatch 301 (.*)$ http://www.newdomainhere.com$1
Save this into .htaccess and upload on the root directory on your old domain.
August 25, 2008, 7:00 pm
$ sudo mount -o loop /path/to/feisty-desktop-i386.iso /tmp/ubuntu-livecd
August 25, 2008, 6:22 am
This command will replace all instances of ‘replaceme’ with ‘newstring’ in files ‘*.php’ on /home/mysite/httpdocs.
find /home/mysite/httpdocs -name '*.php' | xargs replace 'replaceme' 'newstring' --
August 16, 2008, 6:28 am
cat /etc/passwd | cut -d":" -f1