grep
grep 는 보통 혼자서는 쓰이지 않는다.
cat 보통 cat 과 같이 쓰이는 명령어... 물론 혼자서도 쓸수는 있다. 그러나 그 방법은 아직 내가 배운 내용이 아니기때문에 우선 생략하도록 한다. 이후에 내가 혼자서 공부해서 이 글을 계속해서 쓰고 있다면 나올수 있는 내용일듯싶다.
[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 good | grep sbin
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]$
결과물은 sbin 이라는 문자열이 들어있는 행만 출력을 하였다.
그 외에 awk 를 연동하여서 검색하는 강력한 기능이 있다.
'Linux > Beginner Document' 카테고리의 다른 글
locate 의 간단한 사용방법 (0) | 2017.11.22 |
---|---|
find 의 기본적인 사용방법 (0) | 2017.11.22 |
cat 의 간단한 사용방법 (0) | 2017.11.22 |
echo 의 간단한 사용법 (0) | 2017.11.22 |
pwd 의 간단한 이용방법 (0) | 2017.11.22 |