Tuesday, June 7, 2011

linux: check memory usage by 'free'

free -m -t

in MB. Note: since the memory is utilized by kernal than it is wasted. If you are curious how much memory you can use for your applications, you should check the 'free' column in the row of '-/+ buffers/cache'.

Monday, June 6, 2011

linux: sort

Use the command

sort -n -t. -k4

to sort strings like:
------------------------------
str1.str2.str3.1.txt
str1.str2.str3.10.txt
str1.str2.str3.2.txt
str1.str2.str3.21.txt
------------------------------

Use '-t' to define delimiter, '-n' for number sorting, '-k' for column number

Thursday, June 2, 2011

linux: how to generate an animated gif picture

gifsicle --loopcount --colors 256 --delay=50 1.gif 2.gif 3.gif > output.gif

'delay' is a parameter similar as 'frame rate', 50 means 50/100 seconds between frames.

linux: convert pictures (jpg) to avi movie

If you have pic files like:
drilldata00001.jpg
drilldata00002.jpg
drilldata00003.jpg

then you can use:

mencoder -speed 0.1 "mf://drilldata%05d.jpg" -o movie_drilldata.avi -ovc lavc -lavcopts vcodec=mjpeg

to generate an avi movie. The speed '0.1' is slower, '1' used the default frame rate. '1o' goes faster...

Tuesday, January 4, 2011

linux: merge pdf

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=firstANDsecond.pdf -dBATCH first.pdf second.pdf

Sunday, January 2, 2011

Thinkpad 410 brighness adjustment in ubuntu!

http://ubuntuforums.org/showthread.php?t=1515079#post9494941

Have to add

Code:

Option "RegistryDwords" "EnableBrightnessControl=1"

to your /etc/X11/xorg.conf under devices section. Make sure the quotation marks are the same as if you type them.

Wednesday, December 8, 2010

Linux: how to remove ^M at each line end

I got an acsii file from a Window's user. If it is a regular windows text file, then I can use a command 'dos2unix' to convert it in unix format. However, it doesn't work. I use 'less' to have a look at it, it looks like:

line1^M line2^M

. If I use emacs to view it, it looks okay like a regular file. In order to convert it to unix format, I use 'gedit' to do the conversion. A user will be reminded that you save as which format...

Locations of visitors to this page