Category Archives: Linux
Disable unattended upgrades
$ vi /etc/apt/apt.conf.d/10periodic
APT::Periodic::Update-Package-Lists “1″;
APT::Periodic::Download-Upgradeable-Packages “0″;
APT::Periodic::AutocleanInterval “0″;
Count Characters
echo -n “http://find1friend.com/count/chars” | tr -cd “/” | wc -c
#output = 4
Changing default text editor to VIM
sudo update-alternatives –config editor
Selection Path Priority Status
————————————————————
0 /bin/nano 40 [...]
Installing new hard drive
sudo fdisk /dev/sdb
p primary partition (1-4)
sudo mkfs.ext4 -b 4096 /dev/sdb1
sudo mkdir /data2
sudo mount /dev/sdb1 /data2
sudo umount /data2
sudo lshw -C disk
Reference: https://help.ubuntu.com/community/InstallingANewHardDrive
Caching nameserver lookups
sudo apt-get install dnsmasq
vi /etc/dnsmasq.conf
listen-address=127.0.0.1
vi /etc/dhcp3/dhclient.conf
prepend domain-name-servers 127.0.0.1;
vi /etc/resolv.conf
search yourisp.com
nameserver 127.0.0.1
nameserver xxx.xxx.xxx.xxx
sudo /etc/init.d/dnsmasq restart
dig google.com
-= REMOVE =-
apt-get remove –purge dnsmasq
apt-get clean
Reference: http://embraceubuntu.com/2006/08/02/local-dns-cache-for-faster-browsing/
Ubuntu MySQL does not start
1. /etc/init.d/mysql stop
2. comment skip-innodb in your my.cnf
3. rm /var/lib/mysql/ib*
4. mysql_install_db –user=mysql
5. /etc/init.d/mysql start
Running multiple instances of MySQL
Ubuntu 10.04 settings /etc/mysql/my.cnf
[mysql.server]
use-manager
[manager]
default-mysqld-path = /usr/sbin/mysqld
socket = /tmp/manager.sock
pid-file = /tmp/manager.pid
password-file [...]
Search recursively through Bash and Perl source code
.bashrc
#—————————————————————–#
# Search recursively through code omitting svn and comments.
#—————————————————————–#
function fs()
{
find . -exec grep -il “$1″ {} \; -print | grep -0v .svn \
| xargs grep -i “$1″ | grep -v “\#” | sed -e “s/:.*//g” | sort -u
}
#—————————————————————–#
# Search recursively through code comments only [...]
ssh login with rsa pub key
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub | ssh REMOTE_SERVER ‘cat – >> ~/.ssh/authorized_keys’
ssh REMOTE_SERVER ‘chmod 700 .ssh’
ssh REMOTE_SERVER
Ubuntu Server Edition
Ubuntu Server Edition is changing the server market for businesses by delivering the best of free software on a stable, fully supported and secure platform.
Reference: http://www.ubuntu.com/getubuntu/download-server