cat

 

cat 은 고양이의 켓이 아니라 보여달라는 리눅스의 명령어이다.

cat은 혼자 쓰이기도 하지만 보통은 여러가지 부수적인 명령어와 같이 쓰인다.

그 명령어들은 grep, |, >, less, more 등 여러가지가 있다.

 

[dangerzo@dangerzo dangerzo]$ ls

abab  good  want_3  want_4  want_5  want_6  wanted_1

[dangerzo@dangerzo dangerzo]$ cat good <- good 파일을 보여줘~!~!

UID        PID  PPID  C STIME TTY          TIME CMD

root         1     0  0 13:34 ?        00:00:04 init

root         2     1  0 13:34 ?        00:00:00 [keventd]

root         3     1  0 13:34 ?        00:00:00 [kapmd]

root         4     1  0 13:34 ?        00:00:00 [ksoftirqd_CPU0]

root         9     1  0 13:34 ?        00:00:00 [bdflush]

root         5     1  0 13:34 ?        00:00:00 [kswapd]

root         6     1  0 13:34 ?        00:00:00 [kscand/DMA]

root         7     1  0 13:34 ?        00:00:00 [kscand/Normal]

root         8     1  0 13:34 ?        00:00:00 [kscand/HighMem]

root        10     1  0 13:34 ?        00:00:00 [kupdated]

root        11     1  0 13:34 ?        00:00:00 [mdrecoveryd]

root        15     1  0 13:34 ?        00:00:00 [kjournald]

root        73     1  0 13:34 ?        00:00:00 [khubd]

root      1258     1  0 13:34 ?        00:00:00 [kjournald]

root      1259     1  0 13:34 ?        00:00:00 [kjournald]

root      1571     1  0 13:35 ?        00:00:00 syslogd -m 0

root      1575     1  0 13:35 ?        00:00:00 klogd -x

rpc       1585     1  0 13:35 ?        00:00:00 [portmap]

rpcuser   1604     1  0 13:35 ?        00:00:00 [rpc.statd]

root      1671     1  0 13:35 ?        00:00:00 /usr/sbin/apmd -p 10 -w 5 -W -P

root      1721     1  0 13:35 ?        00:00:00 /usr/sbin/sshd

root      1735     1  0 13:35 ?        00:00:00 xinetd -stayalive -reuse -pidfil

root      1771     1  0 13:35 ?        00:00:00 [sendmail]

smmsp     1780     1  0 13:35 ?        00:00:00 [sendmail]

root      1790     1  0 13:35 ?        00:00:00 gpm -t imps2 -m /dev/mouse

root      1799     1  0 13:35 ?        00:00:00 crond

root      1810     1  0 13:35 ?        00:00:00 cupsd

daemon    1860     1  0 13:35 ?        00:00:00 [atd]

root      1869     1  0 13:35 tty2     00:00:00 /sbin/mingetty tty2

root      1870     1  0 13:35 tty3     00:00:00 /sbin/mingetty tty3

root      1871     1  0 13:35 tty4     00:00:00 /sbin/mingetty tty4

root      1872     1  0 13:35 tty5     00:00:00 /sbin/mingetty tty5

root      1873     1  0 13:35 tty6     00:00:00 /sbin/mingetty tty6

root     15227     1  0 14:49 ?        00:00:00 [login]

dangerzo 15228 15227  0 14:50 tty1     00:00:00 -bash

root     15337 15228  0 14:54 tty1     00:00:00 [su]

root     15338 15337  0 14:54 tty1     00:00:00 -bash

root     15388 15338  0 15:00 tty1     00:00:00 ps -ef

[dangerzo@dangerzo dangerzo]$

 

[dangerzo@dangerzo dangerzo]$ cat good | less <- good 파일을 보여줘 그런대 잘라서보여줘

UID        PID  PPID  C STIME TTY          TIME CMD

root         1     0  0 13:34 ?        00:00:04 init

root         2     1  0 13:34 ?        00:00:00 [keventd]

root         3     1  0 13:34 ?        00:00:00 [kapmd]

root         4     1  0 13:34 ?        00:00:00 [ksoftirqd_CPU0]

root         9     1  0 13:34 ?        00:00:00 [bdflush]

root         5     1  0 13:34 ?        00:00:00 [kswapd]

root         6     1  0 13:34 ?        00:00:00 [kscand/DMA]

root         7     1  0 13:34 ?        00:00:00 [kscand/Normal]

root         8     1  0 13:34 ?        00:00:00 [kscand/HighMem]

root        10     1  0 13:34 ?        00:00:00 [kupdated]

root        11     1  0 13:34 ?        00:00:00 [mdrecoveryd]

root        15     1  0 13:34 ?        00:00:00 [kjournald]

root        73     1  0 13:34 ?        00:00:00 [khubd]

root      1258     1  0 13:34 ?        00:00:00 [kjournald]

root      1259     1  0 13:34 ?        00:00:00 [kjournald]

root      1571     1  0 13:35 ?        00:00:00 syslogd -m 0

root      1575     1  0 13:35 ?        00:00:00 klogd -x

rpc       1585     1  0 13:35 ?        00:00:00 [portmap]

rpcuser   1604     1  0 13:35 ?        00:00:00 [rpc.statd]

root      1671     1  0 13:35 ?        00:00:00 /usr/sbin/apmd -p 10 -w 5 -W -P

root      1721     1  0 13:35 ?        00:00:00 /usr/sbin/sshd

root      1735     1  0 13:35 ?        00:00:00 xinetd -stayalive -reuse -pidfil

:

 

[dangerzo@dangerzo dangerzo]$ cat good <- good 파일을 보여줘

UID        PID  PPID  C STIME TTY          TIME CMD

root         1     0  0 13:34 ?        00:00:04 init

root         2     1  0 13:34 ?        00:00:00 [keventd]

root         3     1  0 13:34 ?        00:00:00 [kapmd]

root         4     1  0 13:34 ?        00:00:00 [ksoftirqd_CPU0]

root         9     1  0 13:34 ?        00:00:00 [bdflush]

root         5     1  0 13:34 ?        00:00:00 [kswapd]

root         6     1  0 13:34 ?        00:00:00 [kscand/DMA]

root         7     1  0 13:34 ?        00:00:00 [kscand/Normal]

root         8     1  0 13:34 ?        00:00:00 [kscand/HighMem]

root        10     1  0 13:34 ?        00:00:00 [kupdated]

root        11     1  0 13:34 ?        00:00:00 [mdrecoveryd]

root        15     1  0 13:34 ?        00:00:00 [kjournald]

root        73     1  0 13:34 ?        00:00:00 [khubd]

root      1258     1  0 13:34 ?        00:00:00 [kjournald]

root      1259     1  0 13:34 ?        00:00:00 [kjournald]

root      1571     1  0 13:35 ?        00:00:00 syslogd -m 0

root      1575     1  0 13:35 ?        00:00:00 klogd -x

rpc       1585     1  0 13:35 ?        00:00:00 [portmap]

rpcuser   1604     1  0 13:35 ?        00:00:00 [rpc.statd]

root      1671     1  0 13:35 ?        00:00:00 /usr/sbin/apmd -p 10 -w 5 -W -P

root      1721     1  0 13:35 ?        00:00:00 /usr/sbin/sshd

root      1735     1  0 13:35 ?        00:00:00 xinetd -stayalive -reuse -pidfil

root      1771     1  0 13:35 ?        00:00:00 [sendmail]

smmsp     1780     1  0 13:35 ?        00:00:00 [sendmail]

root      1790     1  0 13:35 ?        00:00:00 gpm -t imps2 -m /dev/mouse

root      1799     1  0 13:35 ?        00:00:00 crond

root      1810     1  0 13:35 ?        00:00:00 cupsd

daemon    1860     1  0 13:35 ?        00:00:00 [atd]

root      1869     1  0 13:35 tty2     00:00:00 /sbin/mingetty tty2

root      1870     1  0 13:35 tty3     00:00:00 /sbin/mingetty tty3

root      1871     1  0 13:35 tty4     00:00:00 /sbin/mingetty tty4

root      1872     1  0 13:35 tty5     00:00:00 /sbin/mingetty tty5

root      1873     1  0 13:35 tty6     00:00:00 /sbin/mingetty tty6

root     15227     1  0 14:49 ?        00:00:00 [login]

dangerzo 15228 15227  0 14:50 tty1     00:00:00 -bash

root     15337 15228  0 14:54 tty1     00:00:00 [su]

root     15338 15337  0 14:54 tty1     00:00:00 -bash

root     15388 15338  0 15:00 tty1     00:00:00 ps -ef

[dangerzo@dangerzo dangerzo]$ cat good | grep sbin <- good  파일을 보여줘 그리고 sbin d이라는 부분이 들어간 곳이 있는 것만 보여줘                                                                                                                                                                                                        

root      1671     1  0 13:35 ?        00:00:00 /usr/sbin/apmd -p 10 -w 5 -W -P

root      1721     1  0 13:35 ?        00:00:00 /usr/sbin/sshd

root      1869     1  0 13:35 tty2     00:00:00 /sbin/mingetty tty2

root      1870     1  0 13:35 tty3     00:00:00 /sbin/mingetty tty3

root      1871     1  0 13:35 tty4     00:00:00 /sbin/mingetty tty4

root      1872     1  0 13:35 tty5     00:00:00 /sbin/mingetty tty5

root      1873     1  0 13:35 tty6     00:00:00 /sbin/mingetty tty6

[dangerzo@dangerzo dangerzo]$

[dangerzo@dangerzo dangerzo]$ ls

abab  good  want_3  want_4  want_5  want_6  wanted_1

[dangerzo@dangerzo dangerzo]$ cat good | grep sbin > grep.txt -> sbin이 들어간곳만 있는것을 보여준 것을 grep.txt 라는 파일로 만들어줘

[dangerzo@dangerzo dangerzo]$ ls

abab  good  grep.txt  want_3  want_4  want_5  want_6  wanted_1

[dangerzo@dangerzo dangerzo]$ cat good

UID        PID  PPID  C STIME TTY          TIME CMD

root         1     0  0 13:34 ?        00:00:04 init

root         2     1  0 13:34 ?        00:00:00 [keventd]

root         3     1  0 13:34 ?        00:00:00 [kapmd]

root         4     1  0 13:34 ?        00:00:00 [ksoftirqd_CPU0]

root         9     1  0 13:34 ?        00:00:00 [bdflush]

root         5     1  0 13:34 ?        00:00:00 [kswapd]

root         6     1  0 13:34 ?        00:00:00 [kscand/DMA]

root         7     1  0 13:34 ?        00:00:00 [kscand/Normal]

root         8     1  0 13:34 ?        00:00:00 [kscand/HighMem]

root        10     1  0 13:34 ?        00:00:00 [kupdated]

root        11     1  0 13:34 ?        00:00:00 [mdrecoveryd]

root        15     1  0 13:34 ?        00:00:00 [kjournald]

root        73     1  0 13:34 ?        00:00:00 [khubd]

root      1258     1  0 13:34 ?        00:00:00 [kjournald]

root      1259     1  0 13:34 ?        00:00:00 [kjournald]

root      1571     1  0 13:35 ?        00:00:00 syslogd -m 0

root      1575     1  0 13:35 ?        00:00:00 klogd -x

rpc       1585     1  0 13:35 ?        00:00:00 [portmap]

rpcuser   1604     1  0 13:35 ?        00:00:00 [rpc.statd]

root      1671     1  0 13:35 ?        00:00:00 /usr/sbin/apmd -p 10 -w 5 -W -P

root      1721     1  0 13:35 ?        00:00:00 /usr/sbin/sshd

root      1735     1  0 13:35 ?        00:00:00 xinetd -stayalive -reuse -pidfil

root      1771     1  0 13:35 ?        00:00:00 [sendmail]

smmsp     1780     1  0 13:35 ?        00:00:00 [sendmail]

root      1790     1  0 13:35 ?        00:00:00 gpm -t imps2 -m /dev/mouse

root      1799     1  0 13:35 ?        00:00:00 crond

root      1810     1  0 13:35 ?        00:00:00 cupsd

daemon    1860     1  0 13:35 ?        00:00:00 [atd]

root      1869     1  0 13:35 tty2     00:00:00 /sbin/mingetty tty2

root      1870     1  0 13:35 tty3     00:00:00 /sbin/mingetty tty3

root      1871     1  0 13:35 tty4     00:00:00 /sbin/mingetty tty4

root      1872     1  0 13:35 tty5     00:00:00 /sbin/mingetty tty5

root      1873     1  0 13:35 tty6     00:00:00 /sbin/mingetty tty6

root     15227     1  0 14:49 ?        00:00:00 [login]

dangerzo 15228 15227  0 14:50 tty1     00:00:00 -bash

root     15337 15228  0 14:54 tty1     00:00:00 [su]

root     15338 15337  0 14:54 tty1     00:00:00 -bash

root     15388 15338  0 15:00 tty1     00:00:00 ps -ef

[dangerzo@dangerzo dangerzo]$ cat grep.txt

root      1671     1  0 13:35 ?        00:00:00 /usr/sbin/apmd -p 10 -w 5 -W -P

root      1721     1  0 13:35 ?        00:00:00 /usr/sbin/sshd

root      1869     1  0 13:35 tty2     00:00:00 /sbin/mingetty tty2

root      1870     1  0 13:35 tty3     00:00:00 /sbin/mingetty tty3

root      1871     1  0 13:35 tty4     00:00:00 /sbin/mingetty tty4

root      1872     1  0 13:35 tty5     00:00:00 /sbin/mingetty tty5

root      1873     1  0 13:35 tty6     00:00:00 /sbin/mingetty tty6

[dangerzo@dangerzo dangerzo]$ ls

abab  good  grep.txt  want_3  want_4  want_5  want_6  wanted_1

[dangerzo@dangerzo dangerzo]$

'Linux > Beginner Document' 카테고리의 다른 글

find 의 기본적인 사용방법  (0) 2017.11.22
grep 의 간단한 이용방법  (0) 2017.11.22
echo 의 간단한 사용법  (0) 2017.11.22
pwd 의 간단한 이용방법  (0) 2017.11.22
more 와 less 의 간단한 이용법  (0) 2017.11.22

+ Recent posts