Monday, March 30, 2009

Delete Files Older Than x Days on Linux

Delete Files Older Than x Days on Linux

The find utility on linux allows you to pass in a bunch of interesting arguments, including one to execute another command on each file. We'll use this in order to figure out what files are older than a certain number of days, and then use the rm command to delete them.

Command Syntax

find /path/to/files* -mtime +5 -exec rm {} \;

Note that there are spaces between rm, {}, and \;

Explanation

  • The first argument is the path to the files. This can be a path, a directory, or a wildcard as in the example above. I would recommend using the full path, and make sure that you run the command without the exec rm to make sure you are getting the right results.
  • The second argument, -mtime, is used to specify the number of days old that the file is. If you enter +5, it will find files older than 5 days.
  • The third argument, -exec, allows you to pass in a command such as rm. The {} \; at the end is required to end the command.

This should work on Ubuntu, Suse, Redhat, or pretty much any version of linux.

Thursday, March 19, 2009

Juice for Firefox vs 火狐魔镜



Juice is a Firefox extension by a chinese group in Beijing, which can show the video or picture in your right side bar of Firefox. At the same time, there is a special version of Firefox for China named 火狐魔镜, which offer the similar features. But, this version also have some other buildin extension, among which is the stocks market link, online music, online game. Some of the functions are not avilable outside of China.

How to fix the Firefox memory leak

Original at

http://internetducttape.com/2006/12/02/how-to-fix-the-firefox-memory-leak-firefox-hack/

Firefox memory leak? It doesn’t have one. Unfortunately, because of the way it’s configured to run out of the box it *looks* like it has one.

Follow these simple steps to get your Firefox memory usage under control.

#1: about:config

Type “about:config” into your address bar to access the hidden configuration options for Firefox.

firefox-memory-leak.png

#2: browser.cache.memory.capacity

Controls how much memory is used to cache pages.

Right click on the page and choose New then Integer and create an integer called browser.cache.memory.capacity and set it to a low number. This controls how many kilobytes of memory are used for the browser’s cache.

NOTE: number in screenshot is too small. Aim for 80% of whatever the default is.

firefox-memory-leak3.png

#3: browser.cache.disk.capacity

Controls how much disk space is used to cache pages in kilobytes.

Set browser.cache.disk.capacity to between 5000 or 15000.

128MB to 512M -> 5000.
512BM to 1GB of RAM -> use 15000

firefox-memory-leak6.png

#4: config.trim_on_minimize (optional)

Configure Firefox to swap memory to disk when minimized. This will make Firefox less responsive if you minimize/maximize a lot, but it is good if you need to free memory while multi-tasking to other applications.

Right click on the page and choose New then Boolean and create a boolean called config.trim_on_minimize and set it to true. Now when you minimize the window it will free up memory.

firefox-memory-leak4.png

#5: network.prefetch-next

Network link prefetch will download all pages with the rel=”prefetch” tag. This uses up more memory than you would otherwise think.

Set network.prefetch-next to false.

firefox-memory-leak2.png

#6: browser.sessionhistory.max_total_viewers

This controls how many pages of history are kept in the back/forward buttons. Lower the value to something acceptable. If you do not use back/forward often then you can set this very low.
Set browser.sessionhistory.max_total_viewers to a low number.

firefox-memory-leak5.png

How to fix the Firefox memory leak

Original at

http://internetducttape.com/2006/12/02/how-to-fix-the-firefox-memory-leak-firefox-hack/

Firefox memory leak? It doesn’t have one. Unfortunately, because of the way it’s configured to run out of the box it *looks* like it has one.

Follow these simple steps to get your Firefox memory usage under control.

These configuration changes are a trade-off between internet browsing speed and memory usage. They are most useful if you are multitasking and need Firefox to be less of a memory hog while using other applications.

#1: about:config

Type “about:config” into your address bar to access the hidden configuration options for Firefox.

firefox-memory-leak.png

#2: browser.cache.memory.capacity

Controls how much memory is used to cache pages.

Right click on the page and choose New then Integer and create an integer called browser.cache.memory.capacity and set it to a low number. This controls how many kilobytes of memory are used for the browser’s cache.

NOTE: number in screenshot is too small. Aim for 80% of whatever the default is.

firefox-memory-leak3.png

#3: browser.cache.disk.capacity

Controls how much disk space is used to cache pages in kilobytes.

Set browser.cache.disk.capacity to between 5000 or 15000.

128MB to 512M -> 5000.
512BM to 1GB of RAM -> use 15000

firefox-memory-leak6.png

#4: config.trim_on_minimize (optional)

Configure Firefox to swap memory to disk when minimized. This will make Firefox less responsive if you minimize/maximize a lot, but it is good if you need to free memory while multi-tasking to other applications.

Right click on the page and choose New then Boolean and create a boolean called config.trim_on_minimize and set it to true. Now when you minimize the window it will free up memory.

firefox-memory-leak4.png

#5: network.prefetch-next

Network link prefetch will download all pages with the rel=”prefetch” tag. This uses up more memory than you would otherwise think.

Set network.prefetch-next to false.

firefox-memory-leak2.png

#6: browser.sessionhistory.max_total_viewers

This controls how many pages of history are kept in the back/forward buttons. Lower the value to something acceptable. If you do not use back/forward often then you can set this very low.
Set browser.sessionhistory.max_total_viewers to a low number.

firefox-memory-leak5.png

Monday, March 09, 2009

First picture by my new tablet.

Using my new tablet. Hanvon 0806