티스토리 뷰
cat 명령어
- cat 명령어는 파일을 읽고 표준 출력 장치(콘솔)에 출력하는 명령어이다.
- cat 명령어를 사용하고 읽어들일 파일을 지정하지 않는다면 표준 입력 장치(키보드)의 입력 값을 읽는다.
- cat 명령어는 여러 파일의 내용을 하나로 뭉쳐주는 역할도 한다.
- ">" 혹은 ">>"와 같은 리다이렉션 기호와 함께 사용하며 파일을 생성하고, 저장하는 용도로도 사용될 수 있다.
리다이렉션
📌 표준 입출력을 조절하여 파일 입출력 컨트롤
“>”
- 표준 입력 장치를 기존 파일에 덮어서 입력하는 리다이렉션 기호
“>>”
- 표준 입력 장치가 기존 파일의 뒤에 이어서 입력하는 리다이렉션 기호
# cat > Tuesday
This is a redirection Test
I will enter line change
# cat Tuesday
This is a redirection Test
I will enter line change
# cat >> Tuesday
This is a new redirection Test
# cat Tuesday
This is a redirection Test
I will enter line change
This is a new redirection Test
옵션
cat [ - q ] [ -r ] [ - s ] [ - S ] [ - u ][ - Z ] [ - n [ - b ] ] [ - v [ - e ] [ - t ] ] [ - | File ... ]
Item | Description |
-b | 비어있지 않은 라인 출력 |
-e | 줄 바꿈을 포함한 문장 마지막에 $문자 출력 |
-n | 모든 라인 앞에 라인 번호 출력 (빈 라인도 출력) |
-s | 연속된 빈 라인을 제거하고 출력한다. |
-t | 탭 버튼을 ^I로 표기하여 출력 |
-u | |
-v | tab과 행 바꿈 문자를 제외한 제어 문자를 ^ 형태로 출력한다. |
- | 표준 입력 장치를 읽는다. |
-b
# cat -b Tuesday
1 This is a redirection Test
2 I will enter line change
3 This is a new redirection Test
4 This is a Tab Test
5 ============= 10 Blank Start ===============
6 ============= 10 Blank End ================
-e
# cat -e Tuesday
This is a redirection Test$
I will enter line change$
This is a new redirection Test$
$
This is a Tab Test$
============= 10 Blank Start ===============$
$
$
$
$
$
$
$
$
$
$
============= 10 Blank End ================$
-n
# cat -n Tuesday
1 This is a redirection Test
2 I will enter line change
3 This is a new redirection Test
4
5 This is a Tab Test
6 ============= 10 Blank Start ===============
7
8
9
10
11
12
13
14
15
16
17 ============= 10 Blank End ================
-s
# cat -s Tuesday
This is a redirection Test
I will enter line change
This is a new redirection Test
This is a Tab Test
============= 10 Blank Start ===============
============= 10 Blank End ================
-t
# cat -t Tuesday
This is a redirection Test
I will enter line change
This is a new redirection Test
This^Iis^Ia^ITab^ITest
============= 10 Blank Start ===============
============= 10 Blank End ================
-u
# cat -u Tuesday
This is a redirection Test
I will enter line change
This is a new redirection Test
This is a Tab Test
============= 10 Blank Start ===============
============= 10 Blank End ================
-v
# cat -v Tuesday
This is a redirection Test
I will enter line change
This is a new redirection Test
This is a Tab Test
============= 10 Blank Start ===============
============= 10 Blank End ================
'Computer > Linux' 카테고리의 다른 글
[Linux] 사용자 및 그룹 관리 (1) | 2023.10.31 |
---|---|
[Linux] ln 명령어 (0) | 2023.10.17 |
[Linux] touch 명령어 (1) | 2023.10.17 |
[Linux] 쉘 (Shell) 01 (0) | 2023.09.22 |
[Linux] 입출력 재지정 (IO Redirection) - 입력 재지정 (0) | 2023.09.20 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 스레드
- 프로세스
- 레지스터
- CPU
- static_cast
- 인터럽트
- 명령어
- 함수
- 구조
- const
- 할당
- 백준
- 크기
- 알고리즘
- 상속
- 클래스
- 입출력
- c++
- 컴파일
- dynamic_cast
- 멀티스레드
- 메모리
- 운영체제
- 초기화
- malloc
- 포인터
- New
- thread
- 수학
- 게임수학
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
글 보관함