2011年3月22日 星期二

Linux memory usage

#check total %
ps aux | awk ‘{sum +=$4}; END {print sum}’
#check total mem
ps aux | awk ‘{sum +=$5}; END {print sum}’
#sort
ps -auxf | sort -nr -k 4 | head -5
#free mem checking
free -t -m
#release cache
echo 3 > /proc/sys/vm/drop_caches

2011年3月16日 星期三

Replace: Same as with sed, Replace OLD with NEW:

Vi: Search and Replace

Change to normal mode with .

Search (Wraped around at end of file):

  Search STRING forward :   / STRING.   Search STRING backward:   ? STRING.    Repeat search:   n   Repeat search in opposite direction:  N  (SHIFT-n) 

Replace: Same as with sed, Replace OLD with NEW:
   First occurrence on current line:      :s/OLD/NEW     Globally (all) on current line:        :s/OLD/NEW/g    Between two lines #,#:                 :#,#s/OLD/NEW/g     Every occurrence in file:              :%s/OLD/NEW/g 

2011年3月8日 星期二

Add extension udisk support


Manually Mount storage to host
#eMMC卡的major number跟minor number
# Write storage device path”/dev/block/vold/major:minor” in /lun?/file
echo /dev/block/vold/179:0 > /sys/devices/platform/fsl-usb2-udc/gadget/lun3/file
Manually unmount storage from host.
echo “” > /sys/devices/platform/fsl-usb2-udc/gadget/lun0
Automatic mount storage to host
#modify vold.fstab