samba 로그인 정보를 지우기 위해서는 다음과 같이 하면 된다

'net use /delete //192.168...'

현재 저장되어 있는 정보를 보려면 다음과 같이 하면 된다.

'net use'

iPhone 에서 작성된 글입니다.
Posted by code cat

가끔 svn에서 다음과 같이 충돌이 난다고 한다.


"svn: file_name remains in conflict"


이럴 땐, 당황하지 말고,


svn resolve --accept working file_name


하면 된다.   이래도 좀 더 꼬여서 안 될때가 있는데 그 때는 상위 디렉터리로 이동 뒤,


svn resolve --accept working -R .


하면 된다.


Posted by code cat

출처: http://stackoverflow.com/questions/2966409/cpio-vs-tar-and-cp

 

cpio가 tar보다 나은 점은 뭘까?

 

우선 cpio는 하드링크를 보존한다.  또한 cpio는 파일이름길이에 대한 제한이 없다. timestamp 또한 보존한다. 

스크립트를 쓸 때 파일들에 대한 통제가 편리하다는 점도 있다. 


find . -type f -name '*.sh' -print | cpio -o | gzip >sh.cpio.gz

참고로 find를 써서 많은 파일들의 리스트를 넘기려고 하면 command-line length가 overrun될 가능성이 있다.  그래서 이럴 경우, 중간 파일을 사용해 주는게 좋다.

cp에 대해선 다음에 더 알아보자.

Posted by code cat

vim서 TAB(탭) 4 space



vimrc서 과 이 해 다.


set softtabstop=4                              ; TAB를 때 몇 을 동?

set tabstop=4                                  ; 하나의 TAB을 몇 칸으로 인식? 

set shiftwidth=4                               ; <<, >>을 눌렀을 때 몇 칸을 이동?

set expandtab                                  ; TAB을 space로 인식

;set noexpandtab                                ; TAB을 TAB으로 인식                         

Posted by code cat

쉘 스크립트가 오동작을 하거나 이해하기 힘든 동작을 보일 때, 디버깅을 하려면 다음과 같이 하면 매우 편하다.


#!/bin/sh       ← #!/bin/bash -x 로 바꾸어 준다.


보통 쉘의 시작 부분은 #!/bin/sh로 되어 있는데, 이는 스크립트가 어떤 쉘에서 동작하는지를 정하는 매직코드이다.

그래서 위와 같이 하면, 쉘 코드가 한줄 한줄 실행되는 걸 볼 수 있어 디버깅하기에 좋다.

Posted by code cat

adduser 유저이름


으로 추가하면 된다.

이름, 전화번호 이런걸 물어보는데, 적당히 적어주고 마지막에 입력한 정보가 맞냐고 할 때 Y를 눌러주고 나오면 된다.

잘 만들어졌는지 확인하기 위해, /home/유저이름 으로 된 디렉터리가 생겼는지 확인해 보면 된다.

Posted by code cat
시스템 시간이 다른 머신 사이에서 tar로 압축해서 파일을 옮길때,
tar: 파일 어쩌구저쩌구.c  time stamp 날짜 시간 s in the future 이런 식으로 메세지가 뜨면은

파일을 풀 때, m 옵션을 넣어주면 된다.  man tar를 보면, m옵션에 대해서 다음과 같이 기재되어 있다.

-m, --touch, --modification-time 
don't extract file modified time

 

즉 변환된 시간을 넣지 말라는 소리다.

그러므로,
tar xvfz archive.tar.gz

대신
tar xmvfz archive.tar.gz

하면 된다. 


Posted by code cat

dd if=/dev/zero of=ext3.image bs=1MB count=1024

포맷에 따라서 파일을 복사하거나 변환시킴(주로 빈 파일 만들거나, loopback 디바이스 만들 때 사이즈 할당 시켜서 파일 만들 때 씀)

if=FILE
표준 입력 대신 파일로부터 읽어들인 파일
of=FILE
표준아웃으로 대신 파일로 씀
bs=BYTES
          ibs랑 obs를 BYTES로 강제 설정
count=BLOCKS
BLOCKS 만큼의 입력 블록을 복사함.

더 많은 정보는 http://linux.die.net/man/1/dd

 

'리눅스 > 스크립트/유틸' 카테고리의 다른 글

우분투 사용자 추가  (0) 2012.02.24
tar: time stamp s in the future  (0) 2011.08.26
tee 커맨드  (0) 2011.06.19
엔디안 처리하는 함수  (0) 2011.06.06
busybox cross-compile  (0) 2011.06.01
Posted by code cat
./configure 2>&1 | tee out.txt
configure 결과를 화면에 뿌리고 텍스트 파일에 저장한다

Read from an input and write to a standard output and file.

Syntax

tee [OPTION]... [FILE]...

-a
--append Append to the given FILEs, do not overwrite.
-i ignore interrupt signals.
--help Display the help screen.
--version Display the version.
Examples

ls *.txt | wc -l | tee /dev/tty count.txt

In the above example the ls command would list all .txt files in the current directory, take a word count (wc) by the amount of lines (-l) and the output displayed to the /dev/tty (terminal) will be sent to the count.txt.

Note: Because the above example did not take advantage of the -a or append option if the count.txt file already existed it would have been overwritten.

Related commands

cat


iPhone 에서 작성된 글입니다.
Posted by code cat
int is_little_endian()
{
    long val = 1;
    char *c = (char *) &val;
    return (*c == 1);
}

'리눅스 > 스크립트/유틸' 카테고리의 다른 글

dd (주로 빈 파일 만들기, loopback 마운팅 할 때 쓰임)  (0) 2011.08.02
tee 커맨드  (0) 2011.06.19
busybox cross-compile  (0) 2011.06.01
mount 옵션비교 atime, noatime, relatime  (0) 2011.06.01
xargs 사용법  (0) 2011.04.24
Posted by code cat