2014. 8. 19. 15:08

메타캐릭터

 

 

Tilde(~) : 홈디렉토리 의미

 

cd ~ / cd : 홈디렉토리로 이동, ~ 생략가능

cd ~oracle  / cd ~사용자계정  : 특정사용자의 홈디렉토리 이동

 

*(아스테리크) : 모든

? : 글자

* 글자 수의 제한 없음, ? 1개면 하나에 글자만 가능

 

[] : 대괄호 사이의 모든 글자. 범위지정

rm –f [abc].sh  : 파일명이 a.sh 혹은 b.sh 혹은 c.sh 파일을 지워라

rm –f [ab][0-5].txt : 파일명이 1번째 글자는 a 혹은 b, 두번째 글자는 0-5사이에 있는 txt파일을 지워라

대괄호 안에 [abc] [bca] 같음, 순서는 상관없음

 

[root@server117 test]# ls -al

total 12

drwxr-xr-x  2 root root 4096 Aug 19 20:55 .

drwxr-x--- 16 root root 4096 Aug 19 20:31 ..

-rw-r--r--  1 root root    0 Aug 19 20:55 abcd.sh

-rw-r--r--  1 root root    0 Aug 19 20:55 abs.sh

-rw-r--r--  1 root root    0 Aug 19 20:55 ag.sh <-삭제됨

-rw-r--r--  1 root root    0 Aug 19 20:55 a.sh

-rw-r--r--  1 root root    0 Aug 19 20:55 b.sh

-rw-r--r--  1 root root    0 Aug 19 20:55 c.sh

[root@server117 test]# rm -f [ab][a-h].sh 글자

[root@server117 test]# ls -al

total 12

drwxr-xr-x  2 root root 4096 Aug 19 20:57 .

drwxr-x--- 16 root root 4096 Aug 19 20:31 ..

-rw-r--r--  1 root root    0 Aug 19 20:55 abcd.sh

-rw-r--r--  1 root root    0 Aug 19 20:55 abs.sh

-rw-r--r--  1 root root    0 Aug 19 20:55 a.sh

-rw-r--r--  1 root root    0 Aug 19 20:55 b.sh

-rw-r--r--  1 root root    0 Aug 19 20:55 c.sh

 

Escape Character 탈출문자

* 의미 : 모든

\* 의미 : 단순히 문자로의 *

 

[root@server117 test]# touch a.sh b.sh \*.sh

[root@server117 test]# ls -l

total 0

-rw-r--r-- 1 root root 0 Aug 19 20:55 abcd.sh

-rw-r--r-- 1 root root 0 Aug 19 20:55 abs.sh

-rw-r--r-- 1 root root 0 Aug 19 21:12 a.sh

-rw-r--r-- 1 root root 0 Aug 19 21:12 b.sh

-rw-r--r-- 1 root root 0 Aug 19 20:55 c.sh

-rw-r--r-- 1 root root 0 Aug 19 21:12 *.sh

[root@server117 test]# rm -f \*.sh

[root@server117 test]# ls -l

total 0

-rw-r--r-- 1 root root 0 Aug 19 20:55 abcd.sh

-rw-r--r-- 1 root root 0 Aug 19 20:55 abs.sh

-rw-r--r-- 1 root root 0 Aug 19 21:12 a.sh

-rw-r--r-- 1 root root 0 Aug 19 21:12 b.sh

-rw-r--r-- 1 root root 0 Aug 19 20:55 c.sh

 

쉘 메타캐릭터를 문자로 인식하고 싶으면

! 반드시 !! \을 메타캐릭터 앞에 붙여줘야 함

'OS > linux' 카테고리의 다른 글

dns/ftp 구축시 참고  (0) 2014.08.24
리눅스 dns서버 bind 사용 구축하기  (0) 2014.08.23
8-20일배운것  (0) 2014.08.20
리눅스 설치  (0) 2014.08.20
디스크 관리 명령어  (0) 2014.08.19
Posted by 성장하는yw
2014. 8. 18. 18:27

NFS 서버 구성하기
서버
#vi /etc/hosts 에 상대방의 ip / hostname을 입력저장해줌
#vi /etc/dfs/dfstab
share -o root=server110(허용하는 클라이언트 서버명_ /usr/share/man(허용하는 경로)
 
권한문제가 생겨서 파일이 생기지 않을 때 위와 같이 입력해준다.
/etc/init.d/nfs.server start
share
dfshares
dfmounts

클라이언트
mv /usr/share/man /usr/share/men
man ls : man실행안됨 man 경로에 내용이 없음
mkdir /usr/share/man
mount server110(접속할 서버):/usr/share/man /usr/share/man
man ls : 정상적으로 접속이 되면 man 실행됨
mount
touch /usr/share/man/test : 정상적이면 아래에 파일 만들어짐
dfmounts server110(서버네임) mount상태를 보여줌
umount /usr/share/man 마운트해제
dfmounts server110(서버네임) mount 상태를 보여줌

 

실습2

디스크 추가
touch /reconfigure
init 5
vm에서 하드추가
prtconf : 연결된 하드확인
format
fdisk 포멧 y
partition 파티션
용량줄 때 $ y
label 저장
exit
format에서 verify함 확인(해도되고 안해도됨)

mkdir data
(만약 파티션 나눌 때 포맷 안해줬으면
newfs /dev/rdsk/c0d0s0 으로 포맷해줌)
mount /dev/dsk/c0d1s0 /data
vi /etc/dfs/dfstab
share -o root=server117:server110 /data


포맷
newfs /dev/rdsk/c0d1s1의 형식으로

'OS > unix' 카테고리의 다른 글

shell의 명령어 처리 순서  (0) 2014.09.09
couldn't set locale correctly : 에러남  (0) 2014.09.03
NFS 서버 구성하기1  (0) 2014.08.18
유닉스 명령어 지우기  (0) 2014.08.15
실습  (0) 2014.08.14
Posted by 성장하는yw
2014. 8. 18. 18:09

NFS 서버 구성하기
서버
#vi /etc/hosts 에 상대방의 ip / hostname을 입력저장해줌
#vi /etc/dfs/dfstab
share -o root=server110(허용하는 클라이언트 서버명_ /usr/share/man(허용하

는 경로)
 
권한문제가 생겨서 파일이 생기지 않을 때 위와 같이 입력해준다.

/etc/init.d/nfs.server start
share
dfshares
dfmounts

 

 

클라이언트
mv /usr/share/man /usr/share/men
man ls : man실행안됨 man 경로에 내용이 없음
mkdir /usr/share/man
mount server110(접속할 서버):/usr/share/man /usr/share/man
man ls : 정상적으로 접속이 되면 man 실행됨
mount
touch /usr/share/man/test
: 정상적이면 아래에 파일 만들어짐
dfmounts server110(서버네임) mount상태를 보여줌
umount /usr/share/man 마운트해제
dfmounts server110(서버네임) mount 상태를 보여줌

'OS > unix' 카테고리의 다른 글

couldn't set locale correctly : 에러남  (0) 2014.09.03
nfs2  (2) 2014.08.18
유닉스 명령어 지우기  (0) 2014.08.15
실습  (0) 2014.08.14
fsck / df / du  (0) 2014.08.14
Posted by 성장하는yw