블로그 이미지
박공명

카테고리

분류 전체보기 (99)
된장 (7)
Dev (60)
꼐..꼐임 (6)
식탐 (18)
우리 (0)
Etc (8)
개인자료 (0)
Total
Today
Yesterday

linux favorite command

Dev/linux / 2011. 3. 8. 17:23

사용자가 bash를 사용할때 읽어오는 파일들
.profile : basic infomation
.bashrc : bash infomation
.bash_history : have bash command history
.bash_logout : when logout, system execute this command.(clear tmp,make history)
file :
if no have home directory, system use /etc/profile file.
% Order of execution
execute shell -> bash_profile  -> bashrc | bash_logout(when logout)

~ : $HOME
- : previous directory
export : 지정된 환경보기

와일드카드
* : 모든문자
? : 한개의문자
[abc] : a,b,c중한개
[a-z] : a-z까지의 모든문자
[:alnum:] : 알파벳과숫자 
[:alpha:] : 알파벳
[:digit:] :숫자
[:upper:] : 알파벳대문자
[:lower:] : 알파벳소문자

brace expansion
$echo a{1,2,3}
a1 a2 a3
$ echo a{1{1,2,3},2{1,2,3},3{1,2,3}}
a11 a12 a13 a21 a22 a23 a31 a32 a33

I/O redirection
> out : out으로 출력
< in : in으로부터 입력
>> out : out으로 이어붙임
2> :  표준에러의 출력방향
1> : 표준출력
2>&1 : 에러를 표준출력과같이 출력
1>&2 : 표준출력을 에러와같이 출력

pipeline
$ls | more
is
ls > tmp -> more < tmp

background job
find . -name "findname" 2>&1 > output &
find의결과물중 에러를 표준출력과 합치며 표준출력은 output파일로전달하며 백그라운드로작업
nohup
&는 일반적으로 터미널이 기동중에서만 프로세서를 잡고있게되는데
nohup는 터미널이 종료해도(hang up signal) 잡고있게된다.
특정 flag를 통하여 &를 nohup과 동일하게 쓸수있다.
$shopt | grep huponexit
huponexit       off

emacs 편집기능
^b : previous cursor
^f : next cursor
del : delete left character
^d : delete right character
^a : move front
^e : move end
^k : delete from this position to end
^p : move previous command
^n : move next command


테스트했던 예제
echo num of the parameter : $#
echo parameter string     : $@
echo param1 : $1 param2 : $2 param3 : $3
if [ $# > 1 ]; then
 param=$1
 echo param1 substring1to3 : ${param:0:3}
fi
for arg in "$@"
do
 echo ${arg}
done
echo "if test"
BUILD_USERMODE="true"
RESULTMY=if [ "$BUILD_USERMODE" == "qqqq" ];
echo "RESULTMY = $RESULTMY"
if [ "$BUILD_USERMODE" == "true" ]; then
 echo "it's true"
 echo "return is $?"
else
 echo "it's false"
 echo "return is $?"
fi
echo "result = $RESULT"

:= 이건가보다.



Posted by 박공명
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함