Ubuntu Tips – Boot Faster

Bookmark this category

Ubuntu Tips – Boot Faster LinuxLinks: \”With just a few modifications and some experimentation, your Ubuntu box can realise its untapped potential. We have identified 8 tips to help you achieve this. Most of the tips are really easy to implement, and are perfectly safe.\”

URL: http://linuxtoday.com/news_story.php3?ltsn=2009-10-01-018-35-OS-HL-UB

Finding all numbers that are bigger than 1 in vim

If we have a csv like structure

The trick here is simple, lets look at the regex from the begining:

^ – start from the begining
() – start and end of block
[] – digits within this. So we are looking from 2 to 9 to exclude the numbers begining with 1
d – search for digits
* – search for one or more
| – or operation
1 – search for numbers begining with 1
+ – containing atleast one occurence or more.


Initialization or clearing of log files

Like all Unix file systems, open log files can cause a real problem when they get too large and need to be deleted. The problem is, if you delete an open file, the link is removed, but all of the inodes are lost. Even worse, if the program continues to log to the file, the link never re-appears, and additional inodes are lost and are unrecoverable. I suggest two solutions to the above problems.

If you have lost inodes, a simple reboot (make sure FSCK is run on startup) will recover lost inodes and missing filespace.

To empty (or zero out) an open log file, simply issue the following command:

date > logfile

This will \'empty\' the file and insert as the first line the output from the date command. If you want a completely empty file, don\'t enter date,

just > logfile.

This works great on apache and other web server logs, without ever stopping the service.