Jump to content

head (Unix)

This is a fully translated article. Click here for more information.
From DawoumWiki, the free Mathematics self-learning

head
Developer(s)Various open-source and commercial developers
Operating systemUnix, Unix-like, MSX-DOS, IBM i
PlatformCross-platform
TypeCommand
Licensecoreutils: GPLv3

head는 텍스트 파일 또는 파이프된 데이터의 시작을 표시하기 위해 사용되는 유닉스유닉스-계열 운영 시스템프로그램입니다.

Syntax

명령 구문은 다음과 같습니다:

head [options] <file_name>

기본적으로, head는 입력의 처음 10줄을 표준 출력으로 인쇄합니다. 인쇄된 줄의 숫자는 명령줄 옵션으로 변경될 수 있습니다. 다음 예제는 filename의 처음 20줄을 보여줍니다:

head -n 20 filename

이것은 foo로 시작하는 모든 파일의 처음 5줄을 표시합니다:

head -n 5 foo*

대부분의 버전은 n을 생략하고 대신 숫자 -5를 직접 지정하는 것을 허용합니다.[citation needed] GNU head-n 옵션에 대해 음수 인수를 허용하며, 이것은 각 입력 파일의 마지막 인수 값을 제외한 모든 행을 인쇄한다는 의미입니다.

Flags

-c <x number of bytes> Copy first x number of bytes.

Other

유닉스의 많은 초기 버전은 이 명령이 없었고, 문서와 책은 대신 sed를 사용했습니다:

sed 5q filename

이 예제는 모든 줄 (암시적)을 인쇄하고 다섯 번째 줄 이후에 종료합니다.

Implementations

head 명령은 MSX-DOS 버전 2에 대해 ASCII의 MSX-DOS2 도구의 일부이기도 합니다.[1] head 명령은 IBM i 운영 시스템에도 이식되었습니다.[2]

See also

References

External links