Study Memory Work
[Linux] IO Redirect (STREAM) 본문

- Standard Input : 표준입력 방식
cat < linux.txt
head -n1 < linux.txt // -n1 는 파라미터 방식
- Command-line Arguments : 명령어의 인자(파라미터)로 입력 방식
cat linux.txt
head linux.txt
head -n1 linux.txt
- Environment Variables
- Standard Output/Error : 출력 결과를 터미널이 아닌 타 파일에 추출하는 것.
ls -l > list.txt // Standard Output 결과를 text파일로 추출
ls -l 1> list.txt // Standard Output 결과를 text파일로 추출
ls -l 2> error.log // Standard Error 결과를 log파일로 추출
ls -l 1> list.txt 2> error.log // 성공이면 text파일로 에러면 log파일로 저장
- 혼합
head -n1 < linux.txt > linux2.txt // linux파일을 1줄을 linux2 파일에 출력한다
이렇게 Input으로 들어와서 Output으로 흘러나가는 형태 ::: STREAM 이라고 한다.
- 한 txt 파일에 이어서 출력하기 (appand)
ls -al > list.txt // 첫 리다이렉션. txt파일이 생성됨
ls -al >> list.txt // appand됨
'Linux (Ubuntu, macOS)' 카테고리의 다른 글
[Linux] 백그라운드 작업 (1) | 2022.09.29 |
---|---|
[Linux] 프로세스 모니터링 (0) | 2022.09.29 |
[Linux] 디렉토리 / 파일 찾기 (1) | 2022.09.29 |
[Linux] Shell 과 Shellscript (1) | 2022.09.29 |
[Linux] 기초 명령어 (1) | 2022.09.29 |