Monday, October 25, 2010

Useful Commands

Diff 2 directories and ignoring svn directories.

diff -Naur --exclude=".svn" /home/u-boot.orig /home/u-boot-new

Replace string
find ./ -type f -exec sed -i 's/ori_string/new_string/' {} \;

RPM commands
Downgrade package, for example, make
yum --nogpgcheck --releasever=13 downgrade make

Vim commands
How to edit a column (Insert a specific word to the column, for example, // in C file)
1. [Ctrl] + [v] to go into column mode
2. Select the columns and rows where you want to enter your text
3. [Shift] + [i] to go into insert mode in column mode
4. Type in the text you want to enter.
5. Esc to apply your change (or alternately [Ctrl]+[c])
Or press [Esc] twice

How to edit a column (Replace a specific word to the column, for example, // in C file)
1. [Ctrl] + [v] to go into column mode
2. Select the columns and rows where you want to enter your text
3. [c] to go replace mode in column mode
4. Type in the text you want to enter.
5. Esc to apply your change (or alternately [Ctrl]+[c])
Or press [Esc] [Esc]

How to mount FreeBSD partition on Linux
[ ]# mount -r -t ufs -o ufstype=ufs2 /dev/sda2 /mnt

No comments: