사용자:suenky613/Cat (유닉스)

위키백과, 우리 모두의 백과사전.

The cat command is a standard Unix program used to concatenate and display files. The name is from catenate, a synonym of concatenate.

cat 명령어는 파일들을 연결하고 표시하기 위해 사용되는 표준 유닉스 프로그램이다. 이름은 concatenate(연결하다)의 동의어인 catenate에서 유래하였다.

규격[편집]

The Single Unix Specification specifies the behavior that each of the files given in sequence as arguments will write their contents to the standard output in the same sequence, and mandates one option, -u, where each byte is printed as it is read.

단일 유닉스 규격은 인수로서 순서 안에 주어지는 각각의 파일들이 내용을 같은 순서 안에 있는 표준 출력어에 쓰도록 하며, 각각의 바이트들이 그것들이 읽혀지는 것처럼 출력되게 하는 -u라는 하나의 옵션을 명령하도록 하는 행동을 명시한다.

If the filename is specified as -, then cat will read from standard input at that point in the sequence. If no files are specified, cat will read from standard input entered. 만약 파일명이 -로 지정된다면, cat은 그 순서 안에 있는 그 지점에서 표준 입력어를 읽는다. 만약 어떠한 파일들도 지정되지 않았다면, cat은 기입된 표준 입력어를 읽는다.

확장[편집]

Both the BSD versions of cat (as per the OpenBSD manpage) and the GNU coreutils version of cat specify the following options:

cat의 BSD 버전(OpenBSD )과

  • -b (GNU only: --number-nonblank), number non-blank output lines
  • -n (GNU only: --number), number all output lines
  • -s (GNU only: --squeeze-blank), squeeze multiple adjacent blank lines
  • -v (GNU only: --show-nonprinting), displays nonprinting characters as if they were visible, except for tabs and the end of line character
  • -t on BSD, -T on GNU, implies -v but also display tabs as ^I
  • -e on BSD, -E on GNU, implies -v but also display end-of-line characters as $

Unix culture[편집]

Jargon File definition[편집]

The Jargon File version 4.4.7 lists this as the definition of cat: 틀:Quotation1

Useless use of cat[편집]

UUOC (from comp.unix.shell on Usenet) stands for "Useless Use of cat". As received wisdom on comp.unix.shell observes, "The purpose of cat is to concatenate (or 'catenate') files. If it's only one file, concatenating it with nothing at all is a waste of time, and costs you a process." Nevertheless one sees people doing

cat file | some_command and its args .....

instead of the equivalent and cheaper

<file some_command and its args ...

or (equivalently and more classically)

some_command and its args ... <file

Since 1995, occasional awards for UUOC have been given out, usually by Perl luminary Randal L. Schwartz. There is a web page devoted to this and other similar awards. In British hackerdom the activity of fixing instances of UUOC is sometimes called demoggification.

Amongst the mildly paranoid it is still considered safer to use cat for such cases[출처 필요] given that the < and > keys are next to each other in many popular keyboard mappings. While the risk might be low, the impact of using > instead of < can be high and prohibitive.

zcat[편집]

zcat is a UNIX program similar to cat, that decompresses individual files and concatenates them to standard output. Traditionally zcat operated on files compressed by compress but today it is usually able to operate on gzip or even bzip2 archives. On such systems, it's equivalent to gunzip -c.[1]

See also[편집]

External links[편집]


Manual pages[편집]


Other[편집]

References[편집]

  1. [1]zcat manual page in FreeBSD 7.0

틀:Unix commands