Standard Input/Output
fd, file description → 파일서술자(, 파일기술자)stdin, standard input, 표준 입력stdout, standard output, 표준 출력stderr, standard error, 표준 에러fd는 3번 부터 생성된다프로세스 사이 통신으로 사용
anonymous pipe, named pipepipe를 말하면 anonymous pipe 임시로 생성되었다가 소멸 명령어 | → 프로세스들의 직렬 연결find ~ | wc -l
- find ~ 의 실행 결과(출력)를 wc -l의 입력으로 연결
- wc → word count, wc -l은 line 수를 count
- pipe가 없으면 find ~ > tmp.txt; wc -l < tmp.txt; rm tmp.txt
path를 가지는 것을 명명되었다고 표현
명령어 mkfifo
방향 재지정, 채널의 방향을 다른 곳으로 연결
A > B → A의 stdout을 파일 B로 연결A < B → A의 stdin을 파일 B로 연결A >> B → append 모드. >은 내용이 바뀌는 것, >>은 내용이 추가되는 것파일의 내용을 stdout으로 출력
stdin의 입력을 redirection해서 파일로 출력하는 용도
cat > hello.txt
Hello, world!
^D
hello.txt에 Hello, world!가 저장됨