Updates from Arif RSS
-
05:31:19 pm on February 12, 2013 |
Check
apache2
enabled modules:$ sudo apache2ctl -M Loaded Modules: core_module (static) log_config_module (static) logio_module (static) mpm_prefork_module (static) ...
mod_rewrite
(rewrite_module
usually manipulated in.htaccess
) andssl
(for HTTPS) for examples aren’t enabled by default in Ubuntu’ installation ofapache2
.Enable one or more of them via:
$ sudo a2enmod
-
11:31:47 am on July 19, 2012 |
Restoring a production database into VM and change date to make it looks like some point of time inside the production server i.e. in this case May 4, 2010
$ /etc/init.d/mysqld stop $ /etc/init.d/httpd stop $ date +%D -s 2010-05-04 $ date +%T -s 23:00:00 -u
Check date
$ date Tue May 4 19:00:01 EDT 2010
Import database
/etc/init.d/mysqld start /etc/init.d/httpd start mysql -u some-username -p < some-db.sql
Note: Hardware clock option in the VirtualBox VM setting is disabled
-
11:49:45 am on March 8, 2012 |
Check ssh key RSA fingerprint:
$ ssh-keygen -l -f /home/myusername/.ssh/id_rsa.pub 7b:e5:6f:a7:xx:xx:xx:xx:xx:xx:xx:xx:8b:57:xx:xx /home/myusername/.ssh/id_rsa.pub (RSA)
-
08:35:25 am on January 28, 2012 |
Running separate version of
wine
in separate config directory (to isolate errors of running or installation failure)env WINEPREFIX="/home/arif/.wine-newapps" /usr/local/bin/wine-1.1.31/usr/bin/wine /home/arif/.wine-newapps/drive_c/Program\ Files/newapps/newapps.exe
-
01:44:07 pm on January 25, 2012 |
grep omit empty lines:
cat <something> | grep -v "^$"
I keep forgetting this regexp of “match expression at the star of the line”: the “^”
-
09:50:01 am on January 11, 2012 |
Custom run level
init.d
script:startup script on run level 0 and 6, as 34th
start
only e.g.update-rc.d which-tty start 34 0 6 .
will create
/etc/rc0.d/S34which-tty /etc/rc6.d/S34which-tty
-
06:39:59 am on January 10, 2012 |
Checking whether
/dev/video0
or
/dev/ttyUSB0
exists or not (module is installed & probed). They're recognized as "character special file" in
bash
[ -b /dev/ttyUSB0 ] && echo "char special file found" || echo "char special file not found"
Compare the above to "block special file"
[ -b /dev/sda ] && echo "block special file found" || echo "block special file not found"
-
08:03:50 am on August 10, 2011 |
Socket monitoring by watching receive and send queue every 5 seconds
$ while true; do netstat -tn; sleep 5; clear; done
Result:
Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 10.238.133.152:43941 98.136.48.103:5050 ESTABLISHED tcp 1 0 10.238.133.152:42541 8.27.254.249:80 CLOSE_WAIT tcp 1 0 10.238.133.152:34355 184.73.222.16:80 CLOSE_WAIT tcp 0 0 10.238.133.152:43210 199.59.148.87:443 ESTABLISHED tcp 0 229 10.238.133.152:43209 199.59.148.87:443 ESTABLISHED
This is to emulate combination of
watch
andss
in Solaris, more or less same result$ watch -n 5 ss -t
State Recv-Q Send-Q Local Address:Port Peer Address:Port ESTAB 0 0 10.238.133.152:36045 74.125.224.250:https ESTAB 0 0 10.238.133.152:36044 74.125.224.250:https CLOSE-WAIT 1 0 10.238.133.152:59622 174.129.233.179:www ESTAB 0 0 10.238.133.152:43941 98.136.48.103:mmcc CLOSE-WAIT 38 0 10.238.133.152:49300 199.59.148.87:https ESTAB 0 0 10.238.133.152:33626 74.125.224.191:https CLOSE-WAIT 1 0 10.238.133.152:37621 208.46.163.81:www
-
04:30:05 am on July 12, 2011 |
Krusader crash giving signal 11:
1. replace.kde/share/config/krusaderrc
with original one from initial installation
2. remove other files under itWhen installing new, we only need to copy :
$ ls .kde/share/apps/krusader/ krusaderui.rc useractions.xml
-
04:57:28 am on June 15, 2011 |
tcpdump default truncate to 68 bytes snapshot length (snaplen). Use -s 0 to capture all packet length
tcpdump -s 0 -w /tmp/my240.dump -i eth1 port 2000