Posts

Showing posts from December, 2012

How to multiple rename with bash

Sorry the wiseman, I can't remember that guy who post this knowledge. ( he 's alway great ).  In your command line ( bash ) do $ for file_name in *. ; do mv $file_name ${file_name/ / }; done; for example $ for f in *.sql; do mv $f ${f/.sql/.dump}; done; Then every sql files in your current folder will be .dump files hahaha :)

Change hostname on ShogunVPS

Edit /etc/hostname --------------------------    replace on line with myservice.mycompany.com Edit /etc/host -------------------    add new line after 127.0.0.1   localhost    with    127.0.0.1   myservice.mycompany.com **NOTE** this method passed test on ShogunVPS

My command line shortcuts

My command line shortcuts ------------------------------------ alt-d : delete a word, starting at the current cursor position. ctrl-a : move to beginning of line. ctrl-e : move to end of line. ctrl-k : delete all characters in the line, starting the cursor position. ctrl-x : delete all characters in the line before current cursor position. ctrl-u : delete current line. ctrl-w : delete last word of current cursor.

How to disable ubuntu auto update

How to disable ubuntu auto update ----------------------------------------------- ( because it create some spike on incoming network , almost above 2m on zabbix ) 1. Be root 2. edit file /etc/apt/apt.conf.d/10periodic 3. change          APT::Periodic::Update-Package-Lists "1";     to           A PT::Periodic::Update-Package-Lists "0"; thank to Japman ( proteus lead infrastructure )

Clean swap

If i want to clean swap space     $ sudo swapoff -a     $ sudo swapon -a  ref  http://superuser.com/questions/271829/clean-up-swap-memory

SVN adduser

I can both add new svn user or change svn password     htpasswd -m username but if is not valid . I can     htpasswd -c

Deal with mysql_config not found while installing mysql-python

sudo apt-get install mysql sudo apt-get install libmysqlclient-dev then pip install mysql-python ref http://stackoverflow.com/questions/7475223/mysql-config-not-found-when-installing-mysqldb-python-interface

How to start something after boot/reboot

In someway we can deal with rc.local. This is quite a good way to do this that I got this technique from head infrastructure of my company ( the japman ) Edit /etc/rc.local, Add it before sleep command.