Friday, October 31, 2008

Unix Command

1. Disk Usage
#du -sk (Show summary disk usage in K byte)
#du -k (Show detail disk usage in K byte)
2. Find text on File.
$find . grep filename
3. Search String
Unix
====
$strings -a XXXX.exe | grep header
Windows
=======
C:>find /N "Version" XXXX.exe

FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]

/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
/OFF[LINE] Do not skip files with offline attribute set.
"string" Specifies the text string to find.
[drive:][path]filename
Specifies a file or files to search.

If a path is not specified, FIND searches the text typed at the prompt
or piped from another command.

4. Replace word

sed s/"opt"/"d02"/g create_nsdb.sql>create_nsdb.sql.new


5. Remove ^M from file by $vi

On Vi Screen

:%s/^V^M//g

The ^v is a CONTROL-V character and ^m is a CONTROL-M. When you type this, it will look like this:

6. tar

pack file $tar -cvf tar-file directory

unpack $tar -xvf tar-file







No comments: