본문 바로가기

04번. IT 힌트얻기/▶ UNIX

Unix-basic-05

 
cron: 555  모드 ?(y/n) y
cron/queuedefs: 444  모드 ?(y/n) y
rm: queuedefs이(가) 삭제되지 않았습니다.사용 권한이 없습니다.
cron/.proto: 444  모드 ?(y/n) y
rm: .proto이(가) 삭제되지 않았습니다.사용 권한이 없습니다.
cron/at.allow: 444  모드 ?(y/n) y
rm: at.allow이(가) 삭제되지 않았습니다.사용 권한이 없습니다.
cron/cron.allow: 444  모드 ?(y/n) y
▶-R 옵션은 해당 디렉토리와 그 안에 포함되어 있는 파일까지 모두 적용됨
 그리고 permission을 변경해서 cron을 삭제해줄 수 있다.
multihp1:/data2/unix/unix10>chmod -R 777 cron
multihp1:/data2/unix/unix10>rm -r cron
multihp1:/data2/unix/unix10>ls -l
총 0 블록입니다.

multihp1:/data2/unix/unix10>mkdir labdir
multihp1:/data2/unix/unix10>ls -ld labdir
drwxrwxrwx   2 unix10     unix            96 11월 23일 09:22 labdir
multihp1:/data2/unix/unix10>chmod 755 labdir
multihp1:/data2/unix/unix10>ls -ld labdir
drwxr-xr-x   2 unix10     unix            96 11월 23일 09:22 labdir
multihp1:/data2/unix/unix10>cd ..
multihp1:/data2/unix>ls -ld unix10
drwxrwxrwx   3 unix10     unix          1024 11월 23일 09:22 unix10     <---디렉토리 생성시 defalut로 다음과 같은 값을 가짐
multihp1:/data2/unix>cd
multihp1:/data2/unix/unix10>ls -l f1
-rw-r--r--   1 unix10     unix             0 11월 23일 09:21 f1
multihp1:/data2/unix/unix10>cd ../unix11
multihp1:/data2/unix/unix11>ls
f1      labdir
multihp1:/data2/unix/unix11>rm f1
f1: 644  모드 ?(y/n) y

multihp1:/data2/unix/unix11>cd ..
multihp1:/data2/unix>chmod 755 unix10
multihp1:/data2/unix>ls -ld unix10
drwxr-xr-x   3 unix10     unix          1024 11월 23일 09:25 unix10

multihp1:/data2/unix>ls -l /usr/bin/vi
-r-xr-xr-t   6 bin        bin         249856 2007.02.05   /usr/bin/vi
 
multihp1:/data2/unix/unix10>mkdir public
multihp1:/data2/unix/unix10>cd public
multihp1:/data2/unix/unix10/public>touch f1
multihp1:/data2/unix/unix10/public>chmod 600 f1
multihp1:/data2/unix/unix10/public>ls -l f1
-rw-------   1 unix10     unix             0 11월 23일 09:30 f1
multihp1:/data2/unix/unix10/public>ls -ld public
public이(가) 없습니다.
multihp1:/data2/unix/unix10/public>cd
multihp1:/data2/unix/unix10>ls -ld public
drwxrwxrwx   2 unix10     unix            96 11월 23일 09:31 public

<1. unix10가 셋팅을 하고>
multihp1:/data2/unix/unix10>chmod 1777 public
multihp1:/data2/unix/unix10>touch public/f2
multihp1:/data2/unix/unix10>chmod 600 public/f2
<2. unix11에서 다시 한 번 시행해본다.>
multihp1:/data2/unix/unix11>cd ../unix10
multihp1:/data2/unix/unix10>cd public
multihp1:/data2/unix/unix10/public>ls
f1
multihp1:/data2/unix/unix10/public>rm -rf f1
multihp1:/data2/unix/unix10/public>ls
multihp1:/data2/unix/unix10/public>rm -rf
multihp1:/data2/unix/unix10/public>rm -rf f2
rm: f2이(가) 삭제되지 않았습니다.소유자가 아닙니다.

 

▶ umask에 대한 이해 - 없애고 싶은 Permission을 없애는 방법
<umask값>
read    : r : 4
write   : w : 2
execute : x : 1
만약 없애버리고 싶은 허가가 있다면 umask에 설정


multihp1:/data2/unix/unix10>touch f3
multihp1:/data2/unix/unix10>ls -l f3
-rw-rw-rw-   1 unix10     unix             0 11월 23일 09:38 f3
multihp1:/data2/unix/unix10>mkdir labdir2
multihp1:/data2/unix/unix10>ls -ld labdir2
drwxrwxrwx   2 unix10     unix            96 11월 23일 09:38 labdir2

multihp1:/data2/unix/unix10>umask
00
--> 현재 마스크가 설정되어 있지 않다. 특이하게 excute permission에 대해서는 보여주지 않는다.
--> umask에서는 excute없이 두자리만 보여준다.
ex> 0       2       2        <--- 아래보 033보다 022를 쓰는 것이 좋다.
  owner   group  others
 
만약 file일 경우 rw- r-- r--
directory일 경우 rwx r-x r-x   <--디렉토리일 경우는 excute는 나와야 한다. why>change directory를 위해
ex> 0       3       3
  owner   group  others
 
만약 file일 경우 rw- r-- r--
directory일 경우 rwx r-- r--  <--- 이렇게 될 경우 change directory가 불편하게 됨

multihp1:/data2/unix/unix10>touch f4
multihp1:/data2/unix/unix10>mkdir labdir4
multihp1:/data2/unix/unix10>ls -l f4
-rw-r--r--   1 unix10     unix             0 11월 23일 09:45 f4
multihp1:/data2/unix/unix10>ls -ld labdir4
drwxr-xr-x   2 unix10     unix            96 11월 23일 09:45 labdir4
multihp1:/data2/unix/unix10>umask 033
multihp1:/data2/unix/unix10>umask
033
multihp1:/data2/unix/unix10>touch f5
multihp1:/data2/unix/unix10>mkdir labdir5
multihp1:/data2/unix/unix10>ls -l f5
-rw-r--r--   1 unix10     unix             0 11월 23일 09:46 f5
multihp1:/data2/unix/unix10>ls -ld labdir5
drwxr--r--   2 unix10     unix            96 11월 23일 09:46 labdir5

▶ 소유권을 넘겨주고 다시 원복하려면 어떻게 해야 하나요?
< 1. unix10에서 file f3의 owner를 바꾸어주었다.  >
multihp1:/data2/unix/unix10>ls -l
총 0 블록입니다.
-rw-rw-rw-   1 unix10     unix             0 11월 23일 09:38 f3
-rw-r--r--   1 unix10     unix             0 11월 23일 09:45 f4
-rw-r--r--   1 unix10     unix             0 11월 23일 09:46 f5
drwxr-xr-x   2 unix10     unix            96 11월 23일 09:22 labdir
drwxrwxrwx   2 unix10     unix            96 11월 23일 09:38 labdir2
drwxr-xr-x   2 unix10     unix            96 11월 23일 09:45 labdir4
drwxr--r--   2 unix10     unix            96 11월 23일 09:46 labdir5
drwxrwxrwt   2 unix10     unix            96 11월 23일 09:33 public
multihp1:/data2/unix/unix10>chown unix11 f3
multihp1:/data2/unix/unix10>ls -l f3
-rw-rw-rw-   1 unix11     unix             0 11월 23일 09:38 f3
multihp1:/data2/unix/unix10>chown unix10 f3
f3: 소유자가 아닙니다.
multihp1:/data2/unix/unix10>
< 2. unix10에서 소유권 이전한 것을 다시 보내준다.>
multihp1:/data2/unix/unix11>cd ../unix10
multihp1:/data2/unix/unix10>ls -l f3
-rw-rw-rw-   1 unix11     unix             0 11월 23일 09:38 f3
multihp1:/data2/unix/unix10>chown unix10 f3
multihp1:/data2/unix/unix10>ls -l f3
-rw-rw-rw-   1 unix10     unix             0 11월 23일 09:38 f3
multihp1:/data2/unix/unix10>

▶ 소유권 이전에 관한 설명이다. 여기서 -R 옵션은  서브디렉토리를 모두 포함시켜서 변경또는 표현해주는 것이다.
multihp1:/data2/unix/unix10>mkdir -p aa/bb/cc/dd
multihp1:/data2/unix/unix10>ls -lR a
총 0 블록입니다.
drwxr--r--   3 unix10     unix            96 11월 23일 09:56 b
a/b:
총 0 블록입니다.
drwxr--r--   3 unix10     unix            96 11월 23일 09:56 c
a/b/c:
총 0 블록입니다.
drwxr--r--   2 unix10     unix            96 11월 23일 09:56 d
a/b/c/d:
총 0 블록입니다.
multihp1:/data2/unix/unix10>chown unix11 aa
multihp1:/data2/unix/unix10>ls -ld aa
drwxr-xr-x   3 unix11     unix            96 11월 23일 09:58 aa
multihp1:/data2/unix/unix10>ls -lR aa
총 0 블록입니다.
drwxr-xr-x   3 unix10     unix            96 11월 23일 09:58 bb
aa/bb:
총 0 블록입니다.
drwxr-xr-x   3 unix10     unix            96 11월 23일 09:58 cc
aa/bb/cc:
총 0 블록입니다.
drwxr-xr-x   2 unix10     unix            96 11월 23일 09:58 dd
aa/bb/cc/dd:
총 0 블록입니다.
multihp1:/data2/unix/unix10>chown -R unix11 aa/bb
multihp1:/data2/unix/unix10>ls -lR
총 0 블록입니다.
drwxr--r--   3 unix10     unix            96 11월 23일 09:56 a
drwxr-xr-x   3 unix11     unix            96 11월 23일 09:58 aa
-rw-rw-rw-   1 unix11     unix             0 11월 23일 09:38 f3
-rw-r--r--   1 unix10     unix             0 11월 23일 09:45 f4
-rw-r--r--   1 unix10     unix             0 11월 23일 09:46 f5
drwxr-xr-x   2 unix10     unix            96 11월 23일 09:22 labdir
drwxrwxrwx   2 unix10     unix            96 11월 23일 09:38 labdir2
drwxr-xr-x   2 unix10     unix            96 11월 23일 09:45 labdir4
drwxr--r--   2 unix10     unix            96 11월 23일 09:46 labdir5
drwxrwxrwt   2 unix10     unix            96 11월 23일 09:33 public
./a:
총 0 블록입니다.
drwxr--r--   3 unix10     unix            96 11월 23일 09:56 b
./a/b:
총 0 블록입니다.
drwxr--r--   3 unix10     unix            96 11월 23일 09:56 c
./a/b/c:
총 0 블록입니다.
drwxr--r--   2 unix10     unix            96 11월 23일 09:56 d
./a/b/c/d:
총 0 블록입니다.
./aa:
총 0 블록입니다.
drwxr-xr-x   3 unix11     unix            96 11월 23일 09:58 bb
./aa/bb:
총 0 블록입니다.
drwxr-xr-x   3 unix11     unix            96 11월 23일 09:58 cc
./aa/bb/cc:
총 0 블록입니다.
drwxr-xr-x   2 unix11     unix            96 11월 23일 09:58 dd
./aa/bb/cc/dd:
총 0 블록입니다.
./labdir:
총 0 블록입니다.
./labdir2:
총 0 블록입니다.
./labdir4:
총 0 블록입니다.
./labdir5:
총 0 블록입니다.
./public:
총 0 블록입니다.
-rw-------   1 unix10     unix             0 11월 23일 09:33 f2
multihp1:/data2/unix/unix10>
 
 
▶여기서 소유권을 이전할 경우
multihp1:/data2/unix/unix10>id        <--- owner와 그룹 정보
uid=410(unix10) gid=202(unix)
multihp1:/data2/unix/unix10>id java01 <--- owner와 그룹 정보
uid=611(java01) gid=210(java)
multihp1:/data2/unix/unix10>touch ff1
multihp1:/data2/unix/unix10>ls -l ff1
-rw-r--r--   1 unix10     unix             0 11월 23일 10:03 ff1
multihp1:/data2/unix/unix10>chown java01 ff1
multihp1:/data2/unix/unix10>ls -l ff1
-rw-r--r--   1 java01     unix             0 11월 23일 10:03 ff1  <-- 소유권이 owner만 변하고 group은 변화 없음
multihp1:/data2/unix/unix10>touch ff2
multihp1:/data2/unix/unix10>chown java01:java ff2
multihp1:/data2/unix/unix10>ls -l ff2
-rw-r--r--   1 java01     java             0 11월 23일 10:05 ff2  <-- owner, group의 소유권이 모두 변경
multihp1:/data2/unix/unix10>

▶ 디렉토리의 하부 디렉토리까지 소유권 이전하려면 -R 옵션을 사용함
multihp1:/data2/unix/unix10>mkdir -p aaa/bbb/ccc
multihp1:/data2/unix/unix10>chown -R java01:java aaa
 
▶ Group소유권을 이전할 때는 chgrp 명령을 사용함
multihp1:/data2/unix/unix10>chgrp java f5
multihp1:/data2/unix/unix10>ls -l f5
-rw-r--r--   1 unix10     java             0 11월 23일 09:46 f5
 
 
▶ vi를 통해서 만들어준 명령어를 batch job을 통해서 돌려봄
<vi my.sh>
date
ls
cal
multihp1:/data2/unix/unix10>ls -l my.sh
-rw-r--r--   1 unix10     unix            12 11월 23일 10:10 my.sh
multihp1:/data2/unix/unix10>./my.sh
ksh: ./my.sh: cannot execute
multihp1:/data2/unix/unix10>chmod +x my.sh
multihp1:/data2/unix/unix10>./my.sh
2011년11월23일 (수), 오전 10시11분54초
a        aaa      f4       ff1      labdir   labdir4  my.sh
aa       f3       f5       ff2      labdir2  labdir5  public
   November 2011
 S  M Tu  W Th  F  S
       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

 ▶ ps (Process Status)
▶ 현재 떠있는 PROCESS
multihp1:/data2/unix/unix10>ps
   PID TTY       TIME COMMAND
 29073 pts/tS    0:00 ksh
 29072 pts/tS    0:00 telnetd
  1091 pts/tS    0:00 ps
 
multihp1:/data2/unix/unix10>ps -f
     UID   PID  PPID  C    STIME TTY       TIME COMMAND
  unix10 29073 29072  0 09:29:29 pts/tS    0:00 -ksh
  unix10  1195 29073  1 10:29:03 pts/tS    0:00 ps -f
    root 29072   793  0 09:29:29 pts/tS    0:00 telnetd -b /etc/telnet_banner
-가 붙는 것은 로그인할 때 붙는 것이다.
PID  : ProcessID
PPID : Parent ProcessID
DEMON : 대표적인 것. 시스템내부에서 도는 것.. cron (job scheduler), inetd(about network) : super demon
multihp1:/data2/unix/unix10>grep unix10 /etc/passwd
unix10:fyR7PgX/EpXYU:410:202:,,,:/data2/unix/unix10:/usr/bin/ksh   <-- 로그인 할 때 마다 뜨는 shell
multihp1:/data2/unix/unix10>
     UID   PID  PPID  C    STIME TTY       TIME COMMAND
    root     0     0  0  6월 18  ?         7:07 swapper 
    root     8     0  0  6월 18  ?         0:00 supsched
    root     9     0  0  6월 18  ?         0:00 strmem
    root    10     0  0  6월 18  ?         0:00 strweld
    root    11     0  0  6월 18  ?         0:00 strfreebd
    root     2     0  0  6월 18  ?         4:58 vhand
    root     3     0  0  6월 18  ?        64:28 statdaemon
    root     4     0  0  6월 18  ?         3:17 unhashdaemon
    root    12     0  0  6월 18  ?         0:00 ttisr
    root    13     0  0  6월 18  ?         0:00 ioconfigd
    root     1     0  0  6월 18  ?         0:20 init
    root    19     0  0  6월 18  ?         0:25 lvmkd
    root    20     0  0  6월 18  ?         0:20 lvmkd
    root    21     0  0  6월 18  ?         0:18 lvmkd
    root    22     0  0  6월 18  ?         0:23 lvmkd
    root    23     0  0  6월 18  ?         0:21 lvmkd
    root    24     0  0  6월 18  ?         0:23 lvmkd
    root    25     0  0  6월 18  ?         0:00 lvmschedd
    root    26     0  0  6월 18  ?         1:25 smpsched
    root    27     0  0  6월 18  ?         1:28 smpsched
    root    28     0  0  6월 18  ?         0:00 sblksched
    root    29     0  0  6월 18  ?         0:00 sblksched
    root    30     0  0  6월 18  ?         0:44 lvmdevd
    root    31     0  0  6월 18  ?         0:00 lvmattachd    ---> ? 은 시스템 내부에서 도는 것이라고 할 수 있다
    root  2132     1  0  7월 22  console   0:00 -sh
    it02 27967 27966  0 09:10:44 pts/tz    0:00 -ksh          --->pts : 단말기가 돌아가는 거.. 이런 거 userprocess이다.
    root   732     1  0  6월 18  ?         0:00 /usr/sbin/biod 16
    root    37     0  0  6월 18  ?        122:03 vxfsd
    root    65     0  0  6월 18  ?         0:35 lvmdevd
    root    66     0  0  6월 18  ?         0:00 lvmattachd
    root   502     0  0  6월 18  ?         0:01 dmprestored
    root   480     1  0  6월 18  ?        18:35 /usr/sbin/syncer
    root   594     1  0  6월 18  ?         0:38 /usr/sbin/syslogd -D
    root  1245     1  0  6월 18  ?        20:14 /usr/sbin/pwgrd
    root   619     1  0  6월 18  ?         0:00 /usr/lbin/nktl_daemon 0 0 0 0 0
 
multihp1:/data2/unix/unix10>who > who.out
multihp1:/data2/unix/unix10>who 1> who.out   <-- 출력에 대한 descriptor 1
multihp1:/data2/unix/unix10>who | more
root       console      8월 23일 13:49
it00       pts/ta       11월 23일 08:56
it00       pts/tb       11월 23일 08:56
unix04     pts/tc       11월 23일 09:31
unix05     pts/td       11월 23일 10:10
it13       pts/te       11월 23일 08:58
it15       pts/tf       11월 23일 08:58
it10       pts/tg       11월 23일 09:02
it10       pts/th       11월 23일 09:02
--> 파이프는 즉 출력에 대한 descriptor 1을 인지하고 그것을 확인한 수 진행하는 것이다.

출력 | 입력 + 출력 | 입력 + 출력 | 입력
--> 즉 파이프 사이에는 filter 명령어가 들어가는 것이다. sort, wc, grep, cut, uniq etc

 


multihp1:/data2/unix/unix10>who | grep unix | cut -c1-11 | sort | uniq
unix00
unix01
unix04
unix05
unix06
unix07
unix08
unix09
unix10
unix11
unix12
unix13
unix14
unix15

 

▶ unix11에 letter파일을 보내주어라.. 0은 생략되어 있는 것이나 마찬 가지다. (즉, 표준입력은 왼쪽)
multihp1:/data2/unix/unix10>mail unix11 < letter
multihp1:/data2/unix/unix10>mail unix11 0< letter

 

▶ unix11에 ls.out으로 표준 출력을 하라. 표준 출력은 오른쪽이다.
multihp1:/data2/unix/unix10>ls > ls.out
multihp1:/data2/unix/unix10>ls 1> ls.out

 

▶  에러출력을 파이프가 잡지는 못함
multihp1:/data2/unix/unix10>cp
사용법: cp [-f|-i] [-p] [-e warn|force|ignore] source_file target_file
        cp [-f|-i] [-p] [-e warn|force|ignore] source_file ... target_directory
        cp [-f|-i] [-p] -R|-r [-e warn|force|ignore]
            source_directory ... target_directory
multihp1:/data2/unix/unix10>cp | grep R
사용법: cp [-f|-i] [-p] [-e warn|force|ignore] source_file target_file
        cp [-f|-i] [-p] [-e warn|force|ignore] source_file ... target_directory
        cp [-f|-i] [-p] -R|-r [-e warn|force|ignore]
            source_directory ... target_directory
-> 파이프에서는 표준출력을 붙잡는다. 그런데 여기서는 표준출력이 아니라 오류출력이다. 정상출력으로 변경해야 한다.


▶ 오류출력을 정상출력으로 바꾸어주어서 grep을 통해서 패턴 검색을 가능하게 해줌
multihp1:/data2/unix/unix10>cp 2>&1 | grep R
        cp [-f|-i] [-p] -R|-r [-e warn|force|ignore]

 
▶ 중간 생성물을 만들어야 할 경우 아래와 같은 경우는 출력물이 .out으로 넘어가고 파이프가 가져갈 표준 출력은 존재하지 않음
multihp1:/data2/unix/unix10>who > who.out | grep unix > unix.out | sort > sort.out

▶ 표준출력과 파일출력 을 한 다음에 파이프라인에 넘겨주는 역할을 하는 것이 바로 tee이다.
multihp1:/data2/unix/unix10>who | tee who.out | grep unix | tee grep.out | sort > sort.out

 

multihp1:/data2/unix/unix10>
multihp1:/data2/unix/unix10>sleep 1000
ls
date

multihp1:/data2/unix/unix10>sleep 1000 &
[1]     3243
multihp1:/data2/unix/unix10>ls
a         cp.out    f4        ff2       labdir    labdir5   mbox      sort.out
aa        err.out   f5        find.out  labdir2   letter    my.sh     unix.out
aaa       f3        ff1       grep.out  labdir4   ls.out    public    who.out
multihp1:/data2/unix/unix10>ps -f
     UID   PID  PPID  C    STIME TTY       TIME COMMAND
  unix10  3278 28280  1 11:30:52 pts/tI    0:00 ps -f
  unix10  3243 28280  0 11:30:31 pts/tI    0:00 sleep 1000
  unix10 28280 28279  0 09:18:24 pts/tI    0:00 -ksh
    root 28279   793  0 09:18:23 pts/tI    0:00 telnetd -b /etc/telnet_banner

 
multihp1:/data2/unix/unix10>stty -a
speed 9600 baud; line = 0;
rows = 38; columns = 80
min = 1; time = 0;
intr = ^C; quit = ^\; erase = ^H; kill = ^U
eof = ^D; eol = ^@; eol2 <undef>; swtch <undef>
stop = ^S; start = ^Q; susp <undef>; dsusp <undef>
werase <undef>; lnext <undef>
parenb -parodd cs7 -cstopb hupcl -cread -clocal -loblk -crts
-ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr icrnl -iuclc
ixon -ixany ixoff -imaxbel -rtsxoff -ctsxon -ienqak
isig icanon -iexten -xcase echo echoe echok -echonl -noflsh
-echoctl -echoprt -echoke -flusho -pendin
opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel -tostop


multihp1:/data2/unix/unix10>stty susp ^Z
multihp1:/data2/unix/unix10>stty -a
speed 9600 baud; line = 0;
rows = 38; columns = 80
min = 1; time = 0;
intr = ^C; quit = ^\; erase = ^H; kill = ^U
eof = ^D; eol = ^@; eol2 <undef>; swtch <undef>
stop = ^S; start = ^Q; susp = ^Z; dsusp <undef>
werase <undef>; lnext <undef>
parenb -parodd cs7 -cstopb hupcl -cread -clocal -loblk -crts
-ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr icrnl -iuclc
ixon -ixany ixoff -imaxbel -rtsxoff -ctsxon -ienqak
isig icanon -iexten -xcase echo echoe echok -echonl -noflsh
-echoctl -echoprt -echoke -flusho -pendin
opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel -tostop

 

multihp1:/data2/unix/unix10>sleep 1000        <---sleep 하고 있을 때 suspend해서 잠깐 멈춘다. ctrl + z(키 셋팅은 위의 예제 참고)
[2] + Stopped                  sleep 1000
multihp1:/data2/unix/unix10>jobs              <--- jobs를 통해 현재 돌고 있는 job들을 확인한다.
[2] + Stopped                  sleep 1000
[1] -  Running                 sleep 1000 &
multihp1:/data2/unix/unix10>bg %2             <--- 2번 job을 Background 작업으로 돌려라.
[2]     sleep 1000&
multihp1:/data2/unix/unix10>jobs
[2] +  Running                 sleep 1000
[1] -  Running                 sleep 1000 &

▶ Background로 돌리기 위해서는 &를 붙여준다.
multihp1:/data2/unix/unix10>sleep 1000&
[3]     3471
multihp1:/data2/unix/unix10>fg %3
sleep 1000

multihp1:/data2/unix/unix10>sleep 1000&
[3]     3476
multihp1:/data2/unix/unix10>fg %3
sleep 1000
[3] + Stopped                  sleep 1000&
multihp1:/data2/unix/unix10>bg %3
[3]     sleep 1000&
multihp1:/data2/unix/unix10>ps -f
     UID   PID  PPID  C    STIME TTY       TIME COMMAND
  unix10  3419 28280  0 11:34:13 pts/tI    0:00 sleep 1000
  unix10  3476 28280  0 11:38:56 pts/tI    0:00 sleep 1000
  unix10  3487 28280  1 11:39:21 pts/tI    0:00 ps -f
  unix10  3243 28280  0 11:30:31 pts/tI    0:00 sleep 1000
  unix10 28280 28279  0 09:18:24 pts/tI    0:00 -ksh
    root 28279   793  0 09:18:23 pts/tI    0:00 telnetd -b /etc/telnet_banner
multihp1:/data2/unix/unix10>jobs
[3] +  Running                 sleep 1000&
[2] -  Running                 sleep 1000
[1]    Running                 sleep 1000 &
multihp1:/data2/unix/unix10>

multihp1:/data2/unix/unix10>ps -ef | grep unix10 <----- process every full list에대해서...
  unix10 29073 29072  0 09:29:29 pts/tS    0:00 -ksh
  unix10  3584 29073  3 11:40:24 pts/tS    0:00 ps -ef
  unix10 29001 29000  0 09:29:08 pts/tR    0:00 -ksh
  unix10  3585 29073  1 11:40:24 pts/tS    0:00 grep unix10

 

multihp1:/data2/unix/unix10>nohup sleep 10000 &
[1]     3628
multihp1:/data2/unix/unix10>출력을 다음으로 보냅니다:nohup.out

multihp1:/data2/unix/unix10>jobs
[1] +  Running                 nohup sleep 10000 &
multihp1:/data2/unix/unix10>ps
   PID TTY       TIME COMMAND
 29073 pts/tS    0:00 ksh
 29072 pts/tS    0:00 telnetd
  3628 pts/tS    0:00 sleep
  3648 pts/tS    0:00 ps
multihp1:/data2/unix/unix10>ps
   PID TTY       TIME COMMAND
 29073 pts/tS    0:00 ksh
 29072 pts/tS    0:00 telnetd
  3628 pts/tS    0:00 sleep
  3661 pts/tS    0:00 ps
multihp1:/data2/unix/unix10>ps -ef | grep unix10
  unix10 29073 29072  1 09:29:29 pts/tS    0:00 -ksh
  unix10  3628 29073  0 11:41:30 pts/tS    0:00 sleep 10000
  unix10  3669 29073  2 11:42:03 pts/tS    0:00 ps -ef
  unix10 29001 29000  0 09:29:08 pts/tR    0:00 -ksh
  unix10  3670 29073  1 11:42:03 pts/tS    0:00 grep unix10
 

multihp1:/data2/unix/unix10>jobs
multihp1:/data2/unix/unix10>ps
   PID TTY       TIME COMMAND
  3737 pts/tO    0:00 ps
  3717 pts/tO    0:00 telnetd
  3718 pts/tO    0:00 ksh
multihp1:/data2/unix/unix10>ps -ef | grep unix10
  unix10  3761  3718  1 11:43:10 pts/tO    0:00 grep unix10
  unix10  3760  3718  1 11:43:10 pts/tO    0:00 ps -ef
  unix10  3628     1  0 11:41:30 ?         0:00 sleep 10000   <--- 너의 부모는 어차피 너를 보호를 안해줄테니 1인 시스템인 내가 너 1000초 까지 보호해주마..
  unix10 29001 29000  0 09:29:08 pts/tR    0:00 -ksh
  unix10  3718  3717  0 11:42:49 pts/tO    0:00 -ksh
multihp1:/data2/unix/unix10>

 

multihp1:/data2/unix/unix10>ps -ef | grep unix11
  unix11  3948  3947  0 11:48:27 pts/t6    0:00 -ksh
  unix11  3682  3681  0 11:42:39 pts/tD    0:00 -ksh
  unix11  3654     1  0 11:41:48 ?         0:00 sleep 1000
  unix10  4060  3718  2 11:49:30 pts/tO    0:00 grep unix11
  unix11  4022  3948  0 11:49:08 pts/t6    0:00 sleep 1000
multihp1:/data2/unix/unix10>kill 4022
kill: 4022: permission denied
multihp1:/data2/unix/unix10>su unix11
Password:
multihp1:/data2/unix/unix10>id
uid=411(unix11) gid=202(unix)
multihp1:/data2/unix/unix10>kill -9 4022
kill: 4022: no such process
multihp1:/data2/unix/unix10>


multihp1:/data2/unix/unix10>ps -ef | grep sleep
  unix06  3876 28268  0 11:45:49 pts/tH    0:00 sleep 1000
  unix05  3812  3776  0 11:44:07 pts/tT    0:00 sleep 1000
  unix04  3646     1  0 11:41:40 ?         0:00 sleep 10000
  unix00  4281  3684  0 11:58:12 pts/tI    0:00 sleep 10000
  unix15  3677     1  0 11:42:28 ?         0:00 sleep 10000
  unix10  3628     1  0 11:41:30 ?         0:00 sleep 10000
  unix12  3626   561  0 11:41:29 pts/t1    0:00 sleep 10000
  unix09  4066 29490  0 11:49:45 pts/tZ    0:00 sleep 1000
  unix09  4052 29490  0 11:49:28 pts/tZ    0:00 sleep 1000
  unix14  3413 28442  0 11:34:04 pts/tK    0:00 sleep 1000
  unix07  4020 28970  0 11:49:03 pts/tP    0:00 sleep 1000000
  unix05  4150 29334  0 11:53:44 pts/tV    0:00 sleep 10000
  unix00  4285  3684  0 11:58:35 pts/tI    0:00 sleep 20000
  unix01  3665     1  0 11:41:54 ?         0:00 sleep 10000
  unix11  4362  4126  0 11:59:42 pts/tO    0:00 grep sleep
  unix00  4270  3684  0 11:57:40 pts/tI    0:00 sleep 10000
  unix00  3625     1  0 11:41:28 ?         0:00 sleep 10000
  unix12  3465   561  0 11:37:46 pts/t1    0:00 sleep 10000
  unix05  4341  3776  0 11:59:20 pts/tT    0:00 sleep 20000
multihp1:/data2/unix/unix10>ps -ef | grep sleep | grep unix10
  unix10  3628     1  0 11:41:30 ?         0:00 sleep 10000
multihp1:/data2/unix/unix10>kill -9 3628^C
multihp1:/data2/unix/unix10>kill -9 3628
kill: 3628: permission denied
multihp1:/data2/unix/unix10>su unix10
Password:
multihp1:/data2/unix/unix10>
multihp1:/data2/unix/unix10>
multihp1:/data2/unix/unix10>kill -9 3628
multihp1:/data2/unix/unix10>KILL -9 3628
ksh: KILL:  not found
multihp1:/data2/unix/unix10>
multihp1:/data2/unix/unix10>
multihp1:/data2/unix/unix1      \
multihp1:/data2/unix/unix10>
multihp1:/data2/unix/unix10>ps -ef | grep sleep | grep unix10
  unix10  4412  4128  0 12:00:44 pts/tD    0:00 sleep 10000
  unix10  4473  4426  1 12:01:45 pts/tO    0:00 grep sleep

▶ Signal의 list를 보여줌 
multihp1:/data2/unix/unix10>kill -l
 1) HUP                                    16) USR1                                   31) RESERVED
 2) INT                                    17) USR2                                   32) DIL
 3) QUIT                                   18) CHLD                                   33) XCPU
 4) ILL                                    19) PWR                                    34) XFSZ
 5) TRAP                                   20) VTALRM                                 35) bad trap
 6) IOT                                    21) PROF                                   36) bad trap
 7) EMT                                    22) POLL                                   37) RTMIN
 8) FPE                                    23) WINCH                                  38) RTMIN+1
 9) KILL                                   24) STOP                                   39) RTMIN+2
10) BUS                                    25) TSTP                                   40) RTMIN+3
11) SEGV                                   26) CONT                                   41) RTMAX-3
12) SYS                                    27) TTIN                                   42) RTMAX-2
13) PIPE                                   28) TTOU                                   43) RTMAX-1
14) ALRM                                   29) URG                                    44) RTMAX
15) TERM   (Terminate : default)           30) LOST
multihp1:/data2/unix/unix10>


▶ 호스트네임을 ip로 분석하는 기능 , 호스트이름과 ip를 연결해주는 역할을 한다.
ultihp1:/data2/unix/unix10>cat /etc/hosts 
# @(#)B.11.11_LRhosts $Revision: 1.9.214.1 $ $Date: 96/10/08 13:20:01 $
#
# The form for each entry is:
# <internet address>    <official hostname> <aliases>
#
# For example:
# 192.1.2.34    hpfcrm  loghost
#
# See the hosts(4) manual page for more information.
# Note: The entries cannot be preceded by a space.
#       The format described in this file is the correct format.
#       The original Berkeley manual page contains an error in
#       the format description.
#

70.12.220.33    multihp1
127.0.0.1       localhost       loopback
70.12.220.25    hp3                                 <-- hp3를 70.12.220.25로 분석한다.
70.12.220.35    hp5     multihp5        MultiHP5       <IP_address host_Name Alias >
70.12.220.14    hp7
70.12.220.130   multi-sun4      sun4

# ISEE by HP
192.170.77.107  isee.asiapac.hp.com

# MRTG by Jinseong Jeong 2009.11.13
70.12.200.101   mgt

 


multihp1:/data2/unix/unix10>ls -l /etc/hosts
-r--r--r--   1 bin        bin            721 2009.11.13   /etc/hosts


multihp1:/data2/unix/unix10>cat /etc/services
# @(#)B.11.11_LRservices $Revision: 1.32.214.7 $ $Date: 97/09/10 14:50:42 $
#
# This file associates official service names and aliases with
# the port number and protocol the services use.
#
# Some of the services represented below are not supported on HP-UX.
# They are provided solely as a reference.
#
# The form for each entry is:
# <official service name>  <port number/protocol name>  <aliases>
#
# See the services(4) manual page for more information.
# Note: The entries cannot be preceded by a blank space.
#
tcpmux         1/tcp                 # TCP port multiplexer (RFC 1078)
echo           7/tcp                 # Echo
echo           7/udp                 #
discard        9/tcp  sink null      # Discard
discard        9/udp  sink null      #
systat        11/tcp  users          # Active Users
daytime       13/tcp                 # Daytime
daytime       13/udp                 #
qotd          17/tcp  quote          # Quote of the Day
chargen       19/tcp  ttytst source  # Character Generator
chargen       19/udp  ttytst source  #
ftp-data      20/tcp                 # File Transfer Protocol (Data)
ftp           21/tcp                 # File Transfer Protocol (Control)
telnet        23/tcp                 # Virtual Terminal Protocol
smtp          25/tcp                 # Simple Mail Transfer Protocol
time          37/tcp  timeserver     # Time
time          37/udp  timeserver     #
rlp           39/udp  resource       # Resource Location Protocol
whois         43/tcp  nicname        # Who Is
domain        53/tcp  nameserver     # Domain Name Service
domain        53/udp  nameserver     #
bootps        67/udp                 # Bootstrap Protocol Server
bootpc        68/udp                 # Bootstrap Protocol Client
tftp          69/udp                 # Trivial File Transfer Protocol
rje           77/tcp  netrjs         # private RJE Service
finger        79/tcp                 # Finger
http          80/tcp  www            # World Wide Web HTTP
http          80/udp  www            # World Wide Web HTTP
link          87/tcp  ttylink        # private terminal link
supdup        95/tcp                 #
hostnames    101/tcp  hostname       # NIC Host Name Server
tsap         102/tcp iso_tsap iso-tsap # ISO TSAP (part of ISODE)
pop          109/tcp postoffice pop2 # Post Office Protocol - Version 2
pop3         110/tcp  pop-3          # Post Office Protocol - Version 3
portmap      111/tcp  sunrpc         # SUN Remote Procedure Call
portmap      111/udp  sunrpc         #
ident        113/tcp  authentication # RFC1413
sftp         115/tcp                 # Simple File Transfer Protocol
uucp-path    117/tcp                 # UUCP Path Service
nntp         119/tcp  readnews untp  # Network News Transfer Protocol
ntp          123/udp                 # Network Time Protocol
netbios_ns   137/tcp                 # NetBIOS Name Service
netbios_ns   137/udp                 #
netbios_dgm  138/tcp                 # NetBIOS Datagram Service
netbios_dgm  138/udp                 #
netbios_ssn  139/tcp                 # NetBIOS Session Service
netbios_ssn  139/udp                 #
bftp         152/tcp                 # Background File Transfer Protocol
snmp         161/udp  snmpd          # Simple Network Management Protocol Agent
snmp-trap    162/udp  trapd          # Simple Network Management Protocol Traps
bgp          179/tcp                 # Border Gateway Protocol
# PV performance tool services entries
pvserver     382/tcp    # PV server
pvalarm      383/tcp    # PV alarm management
# Ports for IPSec
isakmp       500/tcp  isakmp         # IPSec Key Management (ISAKMP)
isakmp       500/udp  isakmp         # IPSec Key Management (ISAKMP)
#
# UNIX services
#
biff         512/udp  comsat         # mail notification
exec         512/tcp                 # remote execution, passwd required
login        513/tcp                 # remote login
who          513/udp  whod           # remote who and uptime
shell        514/tcp  cmd            # remote command, no passwd used
syslog       514/udp                 # remote system logging
printer      515/tcp  spooler        # remote print spooling
talk         517/udp                 # conversation
ntalk        518/udp                 # new talk, conversation
route        520/udp  router routed  # routing information protocol
efs          520/tcp                 # Extended file name server
timed        525/udp  timeserver     # remote clock synchronization
tempo        526/tcp  newdate        #
courier      530/tcp  rpc            #
conference   531/tcp  chat           #
netnews      532/tcp  readnews       #
netwall      533/udp                 # Emergency broadcasting
uucp         540/tcp  uucpd          # uucp daemon
remotefs     556/tcp  rfs_server rfs # Brunhoff remote filesystem
ingreslock  1524/tcp                 #
#
# Other HP-UX services
#
lansrm       570/udp                 # SRM/UX Server
DAServer     987/tcp                 # SQL distributed access
instl_boots 1067/udp                 # installation bootstrap protocol server
instl_bootc 1068/udp                 # installation bootstrap protocol client
nfsd-keepalive 1110/udp              # Client status info
nfsd-status    1110/tcp              # Cluster status info
msql        1111/tcp                 # Mini SQL database server
rlb         1260/tcp                 # remote loopback diagnostic
clvm-cfg    1476/tcp                 # HA LVM configuration
diagmond    1508/tcp                 # Diagnostic System Manager
nft         1536/tcp                 # NS network file transfer
sna-cs      1553/tcp                 # SNAplus client/server
sna-cs      1553/udp                 # SNAplus client/server
ncpm-pm     1591/udp                 # NCPM Policy Manager
ncpm-hip    1683/udp                 # NCPM Host Information Provider
cvmon       1686/udp                 # Clusterview cvmon-cvmap communication
registrar   1712/tcp                 # resource monitoring service
registrar   1712/udp                 # resource monitoring service
ncpm-ft     1744/udp                 # NCPM File Transfer
psmond      1788/tcp                 # Predictive Monitor
psmond      1788/udp                 # Hardware Predictive Monitor
pmlockd     1889/tcp                 # SynerVision locking daemon
pmlockd     1889/udp                 #
nfsd        2049/udp                 # NFS remote file system
nfsd        2049/tcp                 # NFS remote file system
netdist     2106/tcp                 # update(1m) network distribution service
cvmmon      2300/tcp                 # ClusterView Management cluster support
hp-clic     3384/tcp                 #Cluster Management Services
hp-clic     3384/udp                 #Hardware Management
rfa         4672/tcp                 # NS remote file access
veesm       4789/tcp                 # HP VEE service manager
hacl-hb     5300/tcp                 # High Availability (HA) Cluster heartbeat
hacl-gs     5301/tcp                 # HA Cluster General Services
hacl-cfg    5302/tcp                 # HA Cluster TCP configuration
hacl-cfg    5302/udp                 # HA Cluster UDP configuration
hacl-probe  5303/tcp                 # HA Cluster TCP probe
hacl-probe  5303/udp                 # HA Cluster UDP probe
hacl-local  5304/tcp                 # HA Cluster Commands
hacl-test   5305/tcp                 # HA Cluster Test
hacl-dlm    5408/tcp                 # HA Cluster distributed lock manager
omni        5555/tcp                 # HP OpenView OmniBack
lanmgrx.osB 5696/tcp                 # LAN Manager/X for B.00.00 OfficeShare
r4-sna-cs   5707/tcp                 # SNA client/server (up to Release 4.1)
SNAplus     5708/udp                 # SNA logical network A (up to Release 4.1)
r4-sna-ft   5709/tcp                 # SNA file transfer (up to Release 4.1)
hcserver    5710/tcp                 # HP Cooperative Services
grmd        5999/tcp                 # graphics resource manager
spc         6111/tcp                 # sub-process control
desmevt     6868/tcp                 # DE/ Services Monitor, Event Service
pdclientd   6874/tcp                 # Palladium print client daemon
pdeventd    6875/tcp                 # Palladium print event daemon
iasqlsvr    7489/tcp                 # Information Access
recserv     7815/tcp                 # SharedX Receiver Service
p7_c33upd   8545/tcp    #TSD acceSS7 configuration update RPC server
p7_c33      8546/tcp    #TSD acceSS7 configuration RPC server
p7_c32      8547/tcp    #TSD acceSS7 communications status RPC server
p7_c35      8548/tcp    #TSD acceSS7 communications configuration RPC server
p7_g06      8549/tcp    #TSD acceSS7 application version registration RPC server
p7_e30      8550/tcp    #TSD acceSS7 event manager RPC server
comms_normal     8551/tcp    # acceSS7 normal priority messages
comms_high       8552/tcp    # acceSS7 high priority messages
c34_main         8553/udp    # acceSS7 Inter-Server messages
ftp-ftam    8868/tcp                 # FTP->FTAM Gateway
mcsemon     9999/tcp                 # MC/System Environment monitor
console     10000/tcp                # MC/System Environment console multiplexor
actcp       31766/tcp                # ACT Call Processing Server
SrpSiteDaemon    6178/tcp    # acceSS7 Statistics Remote Site query daemon
SrpCentralDaemon 6179/tcp    # acceSS7 Statistics Central Server query daemon
erdb_svr        35100/tcp    # acceSS7 Statistics Central Database
erdb_bck        35101/tcp    # acceSS7 Statistics Database Backup
hp-sco          19410/tcp    # HP SCO port number
hp-sco          19410/udp    # HP SCO port number
hp-sca          19411/tcp    # HP SCA port number
hp-sca          19411/udp    # HP SCA port number

#
# Kerberos (Project Athena/MIT) services
#
kerberos5    88/udp   kdc            # Kerberos 5 kdc
klogin       543/tcp                 # Kerberos rlogin -kfall
kshell       544/tcp  krcmd          # Kerberos remote shell -kfall
ekshell      545/tcp  krcmd          # Kerberos encrypted remote shell -kfall
kerberos     750/udp  kdc            # Kerberos (server) udp -kfall
kerberos     750/tcp  kdc            # Kerberos (server) tcp -kfall
kerberos_master 751/tcp kadmin       # Kerberos kadmin
krbupdate    760/tcp  kreg           # Kerberos registration -kfall
kpasswd      761/tcp  kpwd           # Kerberos "passwd" -kfall
eklogin     2105/tcp                 # Kerberos encrypted rlogin -kfall
# The X10_LI server for each display listens on ports 5800 + display number.
# The X10_MI server for each display listens on ports 5900 + display number.
# The X11 server for each display listens on ports 6000 + display number.
# The X11 font server listens on port 7000.
# Do NOT associate other services with these ports.
# Refer to the X documentation for details.

hpoms-ci-lstn   5403/tcp        #SAP spooler support
hpoms-dps-lstn  5404/tcp        #SAP spooler support
samd            3275/tcp        # sam daemon

dtspc           6112/tcp        #subprocess control
eusrv       9142/tcp                 # eusrv daemon

swat      901/tcp       # SAMBA Web-based Admin Tool
multihp1:/data2/unix/unix10>


multihp1:/data2/unix/unix10>telnet 70.12.220.33
Trying...
Connected to 70.12.220.33.
Escape character is '^]'.
Local flow control on
Telnet TERMINAL-SPEED option ON

===========================================================================

                                warning

     This is a private computer facility.   Access for any reason must be
     specifically authorized by the manager. Unless you are so authorized,
     your continued access and any other use  may expose you to  criminal
     and/or civil proceedings.


===========================================================================


login: unix10
Password:

이 글은 스프링노트에서 작성되었습니다.

'04번. IT 힌트얻기 > ▶ UNIX' 카테고리의 다른 글

Unix-basic-09(shell)  (0) 2011.11.24
Unix-basic-08  (0) 2011.11.24
Unix-Basic-04  (0) 2011.11.22
Unix-Basic-03  (0) 2011.11.22
Unix-Basic-02  (0) 2011.11.21