JoJun's
Jun's Devlog
JoJun's
전체 방문자
오늘
어제
  • 분류 전체보기 (51)
    • Java (16)
      • SpringBoot (12)
      • Java (4)
    • Linux (11)
      • CentOS (4)
      • 명령어(CentOS) (5)
      • Docker (2)
    • DataBase (15)
      • 튜닝 기법 (1)
      • MSSQL (7)
      • SQLD,SQLP (6)
    • 알고리즘 (4)
      • 정렬 (1)
      • 해시 (1)
      • 완전탐색 (1)
      • 탐욕법 (1)
    • 인프라 (3)
    • Web (2)
    • 개인공간 (0)

블로그 메뉴

  • 홈

공지사항

인기 글

태그

  • Java
  • 알고리즘
  • springboot
  • @Component
  • cors
  • MSSQL
  • Dockerfile
  • log4j2
  • docker
  • 파일그룹

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
JoJun's

Jun's Devlog

[CentOS] 리눅스 파일출력 cat 명령어
Linux/명령어(CentOS)

[CentOS] 리눅스 파일출력 cat 명령어

2022. 2. 23. 13:56
728x90
반응형

cat 명령어는 concatenate를 뜻합니다. 즉 파일을 하나로 합치는 주된 기능을 합니다.

cat명령어는 크게 2가지 기능을 합니다.

  1. 파일의 출력
  2. 파일 합치기

바로 사용법을 보도록 하겠습니다.

 

다음과 같은 파일이 존재한다고 가정을 해보겠습니다.

test1.file

Hello
Hello
Hello

test2.file

World
World
World

 


cat filename

  • cat명령어 뒤에 파일 이름을 명시해 파일 안의 내용을 출력합니다.
jjh@jjh-desktop:~$ cat test1
Hello
Hello
Hello
jjh@jjh-desktop:~$
  • 파일 이름을 여러 개 명시하면 파일의 내용을 합쳐 출력합니다.
jjh@jjh-desktop:~$ cat test1 test2
Hello
Hello
Hello
World
World
World
jjh@jjh-desktop:~$ cat test2 test1
World
World
World
Hello
Hello
Hello
jjh@jjh-desktop:~$

 


cat -n filename

  • -n 옵션으로 줄 번호 옵션을 사용할 수 있습니다.
jjh@jjh-desktop:~$ cat -n  test2 test1
     1  World
     2  World
     3  World
     4  Hello
     5  Hello
     6  Hello
jjh@jjh-desktop:~$

 


cat filename filename > newfilename

  • cat 뒤에 합칠 파일들을 명시해주고 '>' 키워드로 합쳐 만들어질 파일 이름을 명시해줄 수 있습니다.
jjh@jjh-desktop:~$ cat test2 test1 > test3
jjh@jjh-desktop:~$ ls 
test1  test2  test3 
jjh@jjh-desktop:~$

 

728x90
반응형
저작자표시 비영리 변경금지 (새창열림)

'Linux > 명령어(CentOS)' 카테고리의 다른 글

가장 많이 검색하는 리눅스 명령어와 사용 방법 (간략)  (0) 2023.12.07
[CentOS] useradd 사용자 생성의 모든 것 !!!!  (0) 2022.03.08
[CentOS] sudo 명령어 권한 부여  (0) 2022.02.25
[CentOS] 리눅스 서비스 명령어 systemctl  (0) 2022.02.22
    'Linux/명령어(CentOS)' 카테고리의 다른 글
    • 가장 많이 검색하는 리눅스 명령어와 사용 방법 (간략)
    • [CentOS] useradd 사용자 생성의 모든 것 !!!!
    • [CentOS] sudo 명령어 권한 부여
    • [CentOS] 리눅스 서비스 명령어 systemctl
    JoJun's
    JoJun's
    JoJun's의 기술블로그

    티스토리툴바