수정된지 1일이내 파일 찾기
find . -mtime -1 -type f -exec ls -lrt {} \;

수정된지 3일 이상된 파일 삭제
find . -mtime +3 -type f -exec rm -f {} \;

파일크기가 300KB인 파일 찾기
find . -size +300k -type f -ls

파일크기가 1000byte 이하 파일 찾기
find . -size -1000c -type f -ls

확장자가 d로 끝나는 파일 삭제 하기
find . -name *.d -exec rm -rf {} \;

!! find는 recursive하게 수행되기 때문에 삭제등에는 반드시 옵션을 확인후에 사용해야 합니다.
find에 대한 자세한 예제
http://coffeenix.net/board_print.php?bd_code=36

grep recursive로 사용하기
linux에서는 기본적으로 grep -r 옵션이 있기때문에 쉽게 사용할 수 있는데,
solaris에서는 다음과 같이 사용합니다.
find . | xargs grep -s 47518

sed 문자열 치환
sed -e “s%20110808%20110821%” CallList_20110808.txt > CallList_20110821.txt

 

ls -1 | sed ‘s&Centrex&’”VQMS”‘&g’

특정 디렉토리내에서 모든 파일 문자열 치환하기
for file in dailyon/*;
    do sed ‘s/exception.msg/exception.var_info/’ $file > $file.out;
    echo $file;
    mv $file.out $file;
done

‘ escape


상당히 혼동 스럽다 ‘문자열1′    \’   ‘문자열2′ 의 결합된 형태라면 이해가 될까?

sed -e ‘s/’\”/”/g’ a.txt

Mar 092012
 

linux의 경우에는 프로그램 설치후에 바로 실행이 가능한데, solaris 경우 rehash를 사용해서 갱신해줘야 한다.

 

rehash

해시테이블에 있는 데이터를 다시 해싱하는 명령어이다.

시스템 유틸이나 어플리케이션을 설치한 후, 명령어를 언제 어디서든 사용할 수 있도록 해주는 명령이다.

시스템에 프로그램이 설치되면, 단순히 디스크에 저장이 되고, 다음 해시 연산을 수행할 때까지 명령어를 입력해도 인식하지 못한다. 환경변수를 해당 파일에 입력하고 나서 바로 적용이 안되는 것과 같은 이치이다.

 

 

Linux / Unix
Information about the Linux / Unix command rehash.

QUICK LINKS

About rehash
Syntax
Examples
Related commands
Unix main page

ABOUT REHASH

The rehash command recomputes the internal hash table of the contents of directories listed in the path environmental variable to account for new commands added.

SYNTAX

rehash 

EXAMPLES

rehash – recomputes the internal hash table of the contents of directories

RELATED COMMANDS

csh
hashstat
ksh
sh
unhash

 

 

java는 기본적으로 UTF-8 인코딩을 사용한다.
자바 소스파일을 UTF-8 형식으로 저장하고, UTF-8로 컴파일 하면 전혀 문제가 없다.
UTF-8 컴파일 예시:   javac -encoding utf-8 jni/SHMNative.java jni/AlarmEvent.java

다만 이때에는 c++ 소스에서 UTF-8 기반으로 사용된다.

그런데 만약에 EUC-KR로 변환이 필요하다면 iconv로 이용하면 된다.

iconv tutorial을 보고 사용해봤는데,
의외로 잘되지 않았는데 IconvString 이라고 검색해보면 쓰기 좋게 만든 소스가 있다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iconv.h>
#include <errno.h>
 
int IconvString (char *from, char *to, const char *src, char *dst)
{
    size_t srclen;
    size_t dstlen;
    size_t inleftsize, outleftsize;
    size_t res; /* report of iconv */
    iconv_t cd = (iconv_t)-1;
 
    char *inptr;
    char *outptr;
 
    /* open iconv */
    cd = iconv_open(to, from);
    if (cd==(iconv_t)(-1)) {
        return (int)cd;
    }
 
    if (!strcasecmp(from, "UCS-2")) inleftsize=2;
    else {
        srclen = (size_t)strlen(src);
        inleftsize = srclen;
    }
    outleftsize = inleftsize*4;
    dstlen = outleftsize;
    inptr = (char*)src;
    outptr = dst;
 
    while(1) {
        res = iconv(cd,(const char **)&inptr,&inleftsize,&outptr,&outleftsize);
        if (res == (size_t)(-1)) {
            if (errno == EILSEQ) { /* not defined char in the table ? */
                fprintf(stderr, "iconv_str: can't convert[%s]\n", src);
                /* for 2-byte code incompleteness */
                inptr++;
                inleftsize--;
            }
            else if (errno == EINVAL) { /* incomplete char, need readin more codes */
                fprintf(stderr, "iconv_str: incomplete char or shift sequence\n");
                if (inleftsize <= 2) {
                    *outptr = '?';
                    outleftsize--;
                    break;
                }
            }
            *outptr='?';
            outptr++;
            outleftsize--;
            inptr++;
            inleftsize--;
        }
        else break;
    }
    dst[dstlen-outleftsize] = '\0';
    /* close iconv */
    iconv_close(cd);
    return(dstlen-outleftsize);
}
 

apache 에서 환경 변수 사용하기
httpd.conf 파일에서 SetEnv를 이용해서 등록하면 된다.
아래는 cgi-bin에서 구동되는 파일에 적용되는 예이다.

<Directory “/usr/local/apache2/cgi-bin”>
SetEnv SERVER_LOG_HOME /log
SetEnv SERVER_DATA_HOME /data
#PassEnv LD_LIBARY_PATH
SetEnv LD_LIBRARY_PATH /usr/local/lib:/usr/lib:/usr/sfw/lib:/user/items/run/server/lib:/usr/local/ACE/lib:/user/oracle/11202/lib:/user/oracle/1
1202/precomp/lib
SetEnv ORACLE_HOME /user/oracle/11202
SetEnv ORACLE_SID LOFMS
SetEnv TNS_ADMIN /user/oracle/11202/network/admin
SetEnv ORA_NLS33 /user/oracle/11202/ocommon/nls/admin/data
SetEnv NLS_LANG KOREAN_KOREA.KO16MSWIN949
SetEnv ORATAB_FAIL TRUE
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

 

간단하게 unix 에서 메모리릭을 확인 하는 방법이다.
top 으로 해당 프로세스를 확인해서 메모리 증가량을 확인한다.

다만 top 경우 설치가 안된 경우가 많으니,
이때는 prstat를 사용하자.
5초 간격으로 새로고침
prstat 5
거의 top 하고 비슷하다.

오늘 알게된 새로운 팁인데,
pmap pid | tail -1
해당 pid의 메모리 사용현황을 보여주고,
가장 마지막 라인이 전체 사용량이다.
따라서 이것을 루프로 반복적으로 확인하면, 간단하게 메모리 증가량을 확인할 수 있다.

 

1. 가운데 정렬 하기
#wrap { width:900px; margin:0 auto; }

body { text-align:center; }
#wrap { width: 900px; margin:0 auto; text-align:left; }

2. 맑은고딕폰트 웹폰트 적용

IE7 부터 지원

http://800120.tistory.com/39

http://www.kunwi.co.kr/gunwi/board.php?bo_table=B41&wr_id=51&sca=CSS

폰트가 설치되어 있는 경우
FONT-FAMILY:”나눔고딕”, NanumgGothic, 돋음, 바탕 ;

3.  IE6 bug : Horizontal scroll bar in frame.
레퍼런스: http://naradesign.net/wp/2009/04/10/763/
[!--[if IE]]
[frame src="http://" scrolling="yes" /]
[![endif]–]

[!--[if !IE]–]
[frame src="http://" /]
[![endif]]
[/frameset]

© 2012 Dailyon Suffusion theme by Sayontan Sinha