-
- install blueman in AppCenter
- For mouse, add “<device oui=”AB:CD:EF:” type=”mouse” name=”Microsoft Mobile Mouse” pin=”0000″/>”to /usr/share/gnome-bluetooth/pin-code-database.xml which is the MAC of mouse is “AB:CD:EF:GH:IJ:KL”.
- sudo service bluetooth restart
1. Use memory instead of disk
This tip can also lead to data loss. If you do it, you will have to always shut down your computer properly from now on, because unexpected power failures will lead to data loss.
Linux usually ensures that all changes are written to disk every few seconds. Since disk writes are so slow, you can change your system to keep things in memory longer. All changes will be written to memory, and the excruciatingly slow writes to happen in the background while you continue working. This has an instant, noticeable effect, but it can lead to data loss.
Add these lines to /etc/sysctl.conf, and reboot.
vm.swappiness = 0 vm.dirty_background_ratio = 20 vm.dirty_expire_centisecs = 0 vm.dirty_ratio = 80 vm.dirty_writeback_centisecs = 0
The problem: using this tip means that your system stops writing changes to disk until you shut down or type “sync” at a command line. If your system loses power unexpectedly, you will get bad blocks. I did. You can limit the amount of data loss in the event of a power failure to one minute by setting vm.dirty_writeback_centisecs = 6000.
A side effect is that shutting down your computer will may take several minutes where it appears to be doing nothing. Don’t cut the power until it’s done, because it is busy writing all those changes to disk.
Reference: http://stevehanov.ca/blog/index.php?id=48
2. Using ramdisks (tmpfs) for temporary files
It is quite easy to move directories where temporary files are stored (primarily /tmp) to a ramdisk, and it can make a significant difference in performance. The following lines added to /etc/fstab cause /tmp and /var/tmp to be stored in ramdisks:
tmpfs /tmp tmpfs defaults 0 0 tmpfs
/var/tmp tmpfs defaults 0 0 Reference: http://linuxonflash.blogspot.hk/2014/10/optimizing-system-performance-of-flash.html
3. noatime
By default, the ext3/ext4 filesystem updates the access time attribute on a file system object whenever it’s read. This results in even the most trivial file reads result in a write operation. Keeping the access time updated is only important for some very specific tasks which we’re not likely to come across.
Open /etc/fstab
and for each mount that is on your USB storage, add a noatime
parameter. For example:
/dev/mapper/vg_root-lv_root / ext4 errors=remount-ro 0 1
Becomes:
/dev/mapper/vg_root-lv_root / ext4 noatime,errors=remount-ro 0 1
Reference: http://ghanima.net/doku.php?id=wiki:linuxtips:runningfromusb
4. IO Scheduler
Reference: http://tombuntu.com/index.php/2008/09/04/four-tweaks-for-using-linux-with-solid-state-drives/
Reference: http://ghanima.net/doku.php?id=wiki:linuxtips:runningfromusb
The default IO Scheduler used by Ubuntu is cfq
. Changing this to deadline
will see improved performance during times where multiple processes are trying to read/write to disk. You can change the default scheduler for all devices by adding a kernel parameter into grub.
Open /etc/default/grub
and find the following line:
GRUB_CMDLINE_LINUX=""
Add the elevator
option:
GRUB_CMDLINE_LINUX="elevator=deadline"
Or, if you added the verbose
option earlier:
GRUB_CMDLINE_LINUX="elevator=deadline verbose"
Now, use update-grub
to apply your changed setting to grub.cfg
and restart for the change to take effect.
sudo update-grub sudo reboot
To see that your new scheduler has taken effect you can query which scheduler is currently in use for a specific device with this command:
cat /sys/block/<device>/queue/scheduler
To print a list of the messages in the queue, enter:
exim -bp
To remove a message from the queue, enter:
exim -Mrm {message-id}
To remove all messages from the queue, enter:
exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | bash
To remove all messages from the queue with specific word, enter:
exim -bp|grep “username”| awk {‘print $3’}| xargs exim -Mrm
Generate a pass-phraseless SSH key:
$ ssh-keygen -t rsa -b 2048
Generating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/username/.ssh/id_rsa.
Your public key has been saved in /home/username/.ssh/id_rsa.pub.
Copy your keys to the target server:
$ ssh-copy-id id@server
id@server's password:
Now try logging into the machine, with ssh 'id@server'
, and check in:
.ssh/authorized_keys
to make sure we haven’t added extra keys that you weren’t expecting.
Finally check logging in…
$ ssh id@server
id@server:~$
You may also want to look into using ssh-agent
if you want to try keeping your keys protected with a pass-phrase.
Tmpfs
# mkdir -p /mnt/tmp # mount -t tmpfs -o size=20m tmpfs /mnt/tmp
Ramfs
# mkdir -p /mnt/ram # mount -t ramfs -o size=20m ramfs /mnt/ram Reference: http://www.thegeekstuff.com/2008/11/overview-of-ramfs-and-tmpfs-on-linux/
1. yum install ppp -y
2 wget http://poptop.sourceforge.net/yum/stable/packages/ppp-2.4.5-33.0.rhel6.x86_64.rpm
3. rpm -Uhv ppp-2.4.5-33.0.rhel6.x86_64.rpm
4. vi /etc/pptpd.conf
– add “localip 192.168.1.1”
– add “remoteip 192.168.1.2-254”
4. vi /etc/ppp/options.pptpd
– add “ms-dns 8.8.8.8”
5. vi /etc/ppp/chap-secrets
– add “username” pptpd “password” *
6. vi /etc/sysctl.conf
– change “net.ipv4.ip_forward = 1”
7. sysctl -p
– to take effect
8. iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
service iptables save service iptables restart 9. chkconfig pptpd on
init 6
1. crontab -e
2. add the following two lines:
TZ=Asia/Hong_Kong
MAILTO=””
tzselect Please identify a location so that time zone rules can be set correctly. Please select a continent or ocean. 1) Africa 2) Americas 3) Antarctica 4) Arctic Ocean 5) Asia 6) Atlantic Ocean 7) Australia 8) Europe 9) Indian Ocean 10) Pacific Ocean 11) none - I want to specify the time zone using the Posix TZ format. #? 5 Please select a country. 1) Afghanistan 18) Israel 35) Palestine 2) Armenia 19) Japan 36) Philippines 3) Azerbaijan 20) Jordan 37) Qatar 4) Bahrain 21) Kazakhstan 38) Russia 5) Bangladesh 22) Korea (North) 39) Saudi Arabia 6) Bhutan 23) Korea (South) 40) Singapore 7) Brunei 24) Kuwait 41) Sri Lanka 8) Cambodia 25) Kyrgyzstan 42) Syria 9) China 26) Laos 43) Taiwan 10) Cyprus 27) Lebanon 44) Tajikistan 11) East Timor 28) Macau 45) Thailand 12) Georgia 29) Malaysia 46) Turkmenistan 13) Hong Kong 30) Mongolia 47) United Arab Emirates 14) India 31) Myanmar (Burma) 48) Uzbekistan 15) Indonesia 32) Nepal 49) Vietnam 16) Iran 33) Oman 50) Yemen 17) Iraq 34) Pakistan #? 13 The following information has been given: Hong Kong Therefore TZ='Asia/Hong_Kong' will be used. Local time is now: Fri Oct 31 17:10:49 HKT 2014. Universal Time is now: Fri Oct 31 09:10:49 UTC 2014. Is the above information OK? 1) Yes 2) No #? 1 You can make this change permanent for yourself by appending the line TZ='Asia/Hong_Kong'; export TZ to the file '.profile' in your home directory; then log out and log in again. Here is that TZ value again, this time on standard output so that you can use the /usr/bin/tzselect command in shell scripts: Asia/Hong_Kong
Read the rest of this entry
error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
1. edit “/etc/ld.so.conf” or add “/etc/ld.so.conf.d/your.conf”
2. run “ldconfig”
If you have no access right to modify /etc/, you may run command “export”.
1. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
or put it in ~/.bashrc
For ./configure, you may add option like “./configure –prefix=$HOME/yourlib