ls 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-ls
핵심 정리
- 디렉터리의 내용이나 파일의 이름을, 플래그로 고른 정보와 함께 표준 출력에 씁니다.
- 기본은 파일 이름의 알파벳 순서이고,
.(점)으로 시작하는 이름은-a나-A를 줘야 보입니다. root가 실행하면-A가 기본입니다. - 자주 쓰는 플래그는
-l(자세히),-a(숨김 포함),-d(디렉터리 자체),-t(수정 시각 순),-r(역순),-R(하위까지),-i(i-node),-F(종류 표시)입니다. -l출력의 첫 글자는 파일 종류(d,b,c,l,p,s,-)이고, 다음 아홉 글자가 소유자·그룹·다른 사용자의 권한입니다.-e는 열한 번째 글자+로 확장 보안 정보를,-U는E(확장 속성)·e(암호화)를 보여 줍니다.- 6.1에서
-E(VxFS 익스텐트 속성),-S(크기 순 정렬),-U의 암호화 표시e가 생겼습니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (6.1에서 -E, -S, 암호화 표시 e, 보안 절이 더해짐) |
| 원문 | IBM Commands Reference — 5.3 Volume 3, 6.1 Volume 3 |
| 파일 | /usr/bin/ls |
| 관련 명령어 | find, chmod, mkpasswd, aclget, chtcb, getea |
목적
디렉터리의 내용을 표시합니다.
영어 원문
Displays the contents of a directory.
구문
디렉터리의 내용이나 파일의 이름을 표시할 때:
ls [ -1 ] [ -A ] [ -C ] [ -E ] [ -F ] [ -H | -L ] [ -N ] [ -R ] [ -S ] [ -X ] [ -a ] [ -b ] [ -c ] [ -d ]
[ -e ] [ -f ] [ -g ] [ -i ] [ -k ] [ -l ] [ -m ] [ -n ] [ -o ] [ -p ] [ -q ] [ -r ] [ -s ] [ -t ]
[ -u ] [ -U ] [ -x ] [ File ... ]
디렉터리의 내용을 표시할 때:
ls -f [ -C ] [ -d ] [ -i ] [ -m ] [ -s ] [ -X ] [ -x ] [ -1 ] [ -U ] [ Directory ... ]
-E와 -S는 6.1 구문에만 있습니다.
설명
ls 명령은 지정한 Directory 매개변수 각각의 내용이나 File 매개변수 각각의 이름을, 플래그로 요청한 다른 정보와 함께 표준 출력에 씁니다. File이나 Directory 매개변수를 지정하지 않으면 현재 디렉터리의 내용을 표시합니다.
서로 배타적인 짝의 옵션을 둘 다 지정해도 오류가 아닙니다. 짝마다 마지막에 지정한 옵션이 출력 형식을 정합니다.
기본적으로 ls 명령은 모든 정보를 파일 이름의 알파벳 순서로 표시합니다. 대조 순서는 LANG이나 LC_COLLATE 환경 변수가 정합니다.
디렉터리의 내용을 표시할 때, -a나 -A 플래그를 쓰지 않으면 이름이 .(점)으로 시작하는 파일은 보여 주지 않습니다. root가 실행하면 기본으로 -A 플래그를 씁니다.
출력 형식은 크게 세 가지입니다.
- 한 줄에 항목 하나씩 나열합니다.
-C나-x플래그를 지정해 여러 열로 나열합니다. 출력이 터미널(TTY)이면-C가 기본 형식입니다. 파일이나 디렉터리 이름이 너무 길면 한 열로 표시합니다.-m플래그를 지정해 쉼표로 이어 나열합니다.
출력 줄의 글자 수는 COLUMNS 환경 변수로 정합니다. 이 변수가 없으면 화면의 현재 열 값을 가져오고, 두 방법 모두 안 되면 기본값 80을 씁니다.
-U로 보는 열한 번째 글자
-U 플래그로 표시하는 모드는 -l과 같고, 열한 번째 글자가 더해집니다.
| 글자 | 뜻 |
|---|---|
E |
확장 속성(EA) 정보가 있습니다. 파일의 EA는 getea 명령으로 봅니다. |
- |
확장 속성 정보가 없습니다. |
e |
파일이 암호화돼 있습니다(6.1). |
암호화 표시가 접근 제어 목록(ACL)이나 다른 EA보다 우선합니다(6.1).
-e·-l로 보는 모드
첫 글자는 파일 종류입니다.
| 글자 | 뜻 |
|---|---|
d |
디렉터리 |
b |
블록 특수 파일 |
c |
문자 특수 파일 |
l |
심볼릭 링크. -N 플래그를 줬거나 링크가 가리키는 파일이 없을 때 이렇게 표시합니다. |
p |
FIFO(선입선출) 특수 파일 |
s |
로컬 소켓 |
- |
일반 파일 |
다음 아홉 글자는 세 글자씩 세 묶음입니다. 첫 묶음은 소유자의 권한, 다음 묶음은 같은 그룹 사용자의 권한, 마지막 묶음은 그 밖에 접근할 수 있는 모든 사용자의 권한입니다. 묶음 안의 세 글자는 차례로 읽기, 쓰기, 실행 권한입니다. 디렉터리의 실행 권한은 그 디렉터리에서 파일을 찾을 수 있는 권한입니다.
| 글자 | 뜻 |
|---|---|
r |
읽기 |
w |
쓰기(편집) |
x |
실행(검색) |
- |
해당 권한 없음 |
- 그룹 실행 자리는 파일에 set-group-ID가 있으면
s입니다. 소유자 실행 자리는 set-user-ID가 있으면s입니다. - 모드의 마지막 글자(보통
x나-)는 01000(8진수) 비트가 켜져 있으면T입니다(이 모드의 뜻은chmod명령 참고). - 해당 실행 권한이 없으면 set-ID와 01000 비트 표시가 대문자(
S,T)가 됩니다.t는 파일이나 디렉터리에 스티키 비트가 켜져 있다는 뜻입니다.
-e로 보는 열한 번째 글자
-e 플래그로 표시하는 모드는 -l과 같고, 열한 번째 글자가 더해집니다.
| 글자 | 뜻 |
|---|---|
+ |
확장 보안 정보가 있습니다. 예를 들어 확장 ACL, TCB, TP 속성이 있을 수 있습니다. ACL은 aclget 명령으로, TCB와 TP 속성 값은 chtcb 명령으로 봅니다. |
- |
확장 보안 정보가 없습니다. |
디렉터리 안 파일의 크기를 나열할 때는 간접 블록을 포함한 전체 블록 수를 함께 표시합니다.
영어 원문
The ls command writes to standard output the contents of each specified Directory parameter or the name of each specified File parameter, along with any other information you ask for with the flags. If you do not specify a File or Directory parameter, the ls command displays the contents of the current directory.
Specifying more than one of the options in the mutually exclusive pairs is not considered an error. The last option specified in each pair determines the output format.
By default, the ls command displays all information in alphabetic order by file name. The collating sequence is determined by the LANG or LC_COLLATE environment variable.
When the ls command displays the contents of a directory, it does not show entries for files whose names begin with a . (dot) unless you use the -a or -A flag. If the command is executed by root, it uses the -A flag by default.
There are three main ways to format the output:
List one entry per line.
List entries in multiple columns by specifying either the
-Cor-xflag. The-Cflag is the default format when output is to a TTY. The ls command displays single column output if file or directory names are too long.List entries in a comma-separated series by specifying the
-mflag.
To determine the number of character positions in the output line, the ls command uses the COLUMNS environment variable. If this variable is not set, the command gets the current column value of the display. If the ls command cannot determine the number of character positions by either of these methods, it uses a default value of 80.
The mode displayed with the -U flag is the same as with the -l flag, except for the addition of an 11th character interpreted as follows:
- E — Indicates a file has extended attributes (EA) information. The EA of a file is displayed by using the getea command.
-— Indicates a file does not have extended attributes information.- e — Indicates a file is encrypted.
Encryption takes precedence over the presence of the Access Control Lists (ACLs) and other EAs.
The mode displayed with the -e and -l flags is interpreted as follows:
If the first character is:
- d — The entry is a directory.
- b — The entry is a block special file.
- c — The entry is a character special file.
- l — The entry is a symbolic link, and either the
-Nflag was specified or the symbolic link did not point to an existing file. - p — The entry is a first-in, first-out (FIFO) special file.
- s — The entry is a local socket.
-— The entry is an ordinary file.
The next nine characters are divided into three sets of three characters each. The first set of three characters show the owner's permission. The next set of three characters show the permission of the other users in the group. The last set of three characters shows the permission of anyone else with access to the
file. The three characters in each set indicate, respectively, read, write, and execute permission of the file. Execute permission of a directory lets you search a directory for a specified file.
Permissions are indicated as follows:
- r — Read
- w — Write (edit)
- x — Execute (search)
-— Corresponding permission not granted
The group-execute permission character is s if the file has set-group-ID mode. The user-execute permission character is s if the file has set-user-ID mode. The last character of the mode (usually x or -) is T if the 01000 (octal) bit of the mode is set (see the chmod command for the meaning of this mode). The indications of set-ID and 01000 bit of the mode are capitalized (S and T, respectively) if the corresponding execute permission is not set. The mode t indicates that the sticky bit is on for the file or the directory.
The mode displayed with the -e flag is the same as with the -l flag, except for the addition of an 11th character interpreted as follows:
+— Indicates a file has extended security information. For example, the file may have extended ACL, TCB, or TP attributes in the mode. The access control information (ACL) of a file is displayed by using the aclget command. The value of the TCB and TP attributes are displayed by using the chtcb command.-— Indicates a file does not have extended security information.
When the size of the files in a directory are listed, the ls command displays a total count of blocks, including indirect blocks.
플래그
| 플래그 | 설명 |
|---|---|
-A |
.(점)과 ..(점 두 개)를 뺀 모든 항목을 나열합니다. |
-a |
.(점)으로 시작하는 항목을 포함해 디렉터리의 모든 항목을 나열합니다. |
-b |
인쇄할 수 없는 문자를 8진수(\nnn)로 표시합니다. |
-c |
정렬(-t와 함께)이나 표시(-l과 함께)에 i-node의 마지막 변경 시각을 씁니다. -t나 -l과 함께 쓰지 않으면 효과가 없습니다. |
-C |
여러 열 형식으로, 세로 방향으로 정렬해 출력합니다. 출력이 터미널이면 기본입니다. |
-d |
지정한 디렉터리 자체의 정보만 표시합니다. 디렉터리를 파일처럼 다루므로 -l과 함께 디렉터리의 상태를 볼 때 좋습니다. |
-e |
모드(보안 정보 포함), 링크 수, 소유자, 그룹, 크기(바이트), 마지막 수정 시각, 이름을 표시합니다. 특수 파일이면 크기 자리에 주·부 장치 번호를 표시합니다. 심볼릭 링크면 링크가 가리키는 파일의 경로를 -> 뒤에 표시하고, 링크 자체의 속성을 보여 줍니다. |
-E |
VxFS 파일 시스템에 있는 파일의 익스텐트 속성(공간 예약, 고정 익스텐트 크기, 익스텐트 할당 플래그 정보)을 나열합니다. -l과 함께 써야 하며, 아니면 -E를 무시하고 실행을 마칩니다. 6.1부터 |
-f |
Directory 매개변수로 지정한 디렉터리마다 각 슬롯의 이름을 나열합니다. -l, -t, -s, -r을 끄고 -a를 켭니다. 디렉터리에 항목이 들어 있는 순서대로 나열합니다. |
-F |
디렉터리면 /(슬래시), 실행할 수 있으면 *(별표), 소켓이면 =(등호), FIFO면 |(파이프), 심볼릭 링크면 @를 이름 뒤에 붙입니다. 피연산자로 준 심볼릭 링크는 -H나 -L을 지정하지 않으면 따라가지 않습니다. |
-g |
-l과 같은 정보를 표시하되 소유자와 심볼릭 링크 정보는 빼고 표시합니다. |
-H |
명령줄에 지정한 심볼릭 링크가 디렉터리를 가리키면, 파일 정보와 파일 종류는 링크가 가리키는 파일의 것으로 하고, 이름은 링크 자체의 이름을 씁니다. |
-i |
보고서의 첫 열에 파일마다 i-node 번호를 표시합니다. 파일 시스템에 내부 스냅숏이 있으면 .snapshot 디렉터리와 그 안의 모든 내용은 고유한 i-node 번호를 갖지 않습니다(이 문장은 6.1). |
-k |
-s 옵션의 블록 크기와, -l, -n, -g, -o 옵션이 디렉터리마다 쓰는 블록 수의 단위를 1024바이트로 정합니다. |
-L |
링크가 가리키는 파일이나 디렉터리의 내용을 나열합니다. 기본 동작이며 심볼릭 링크를 따라갑니다. -l을 쓰면 -N이 기본이 되어 심볼릭 링크를 따라가지 않으며, 이때 -N 기본값을 바꿀 수 있는 것은 -L뿐입니다. |
-l |
(소문자 L) 파일마다 모드, 링크 수, 소유자, 그룹, 크기(바이트), 마지막 수정 시각을 표시합니다. 특수 파일이면 크기 자리에 주·부 장치 번호를 표시합니다. 마지막 수정이 여섯 달보다 오래됐으면 시각 자리를 "월 일 연도"로, 여섯 달 안이면 "월 일 시각"으로 표시합니다. 심볼릭 링크면 링크가 가리키는 파일의 경로를 -> 뒤에 표시하고 링크 자체의 속성을 보여 줍니다. -n, -g, -o가 -l보다 우선합니다. |
-m |
쉼표로 이은 스트림 형식으로 출력합니다. |
-n |
-l과 같은 정보를 표시하되, 사용자·그룹 이름 대신 사용자 ID와 그룹 ID를 표시합니다. |
-N |
파일의 상태를 정할 때 심볼릭 링크를 따라가지 않습니다. |
-o |
-l과 같은 정보를 표시하되 그룹과 심볼릭 링크 정보는 빼고 표시합니다. |
-p |
디렉터리면 이름 뒤에 슬래시를 붙입니다. ls 출력을 pr 명령으로 넘길 때 좋습니다. |
-q |
파일 이름의 인쇄할 수 없는 문자를 ?(물음표)로 표시합니다. |
-r |
정렬 순서를 뒤집어, 알파벳 역순이나 오래된 것부터 표시합니다. |
-R |
하위 디렉터리를 모두 재귀적으로 나열합니다. |
-s |
항목마다 크기를 킬로바이트 단위(간접 블록 포함)로 표시합니다. |
-S |
파일 크기(큰 것부터)를 첫째 키로, 대조 순서에 따른 파일 이름(작은 것부터)을 둘째 키로 정렬합니다. 6.1부터 |
-t |
이름 대신 마지막 수정 시각(최근 것부터)으로 정렬합니다. 심볼릭 링크는 링크 자체의 시각으로 정렬합니다(이 문장은 6.1). |
-U |
-l과 비슷한 정보를 표시합니다. 모드(보안 정보, 이름 있는 확장 속성 정보, 암호화 정보 포함), 링크 수, 소유자, 그룹, 크기(바이트), 마지막 수정 시각, 이름을 표시합니다. 특수 파일이면 크기 자리에 주·부 장치 번호를, 심볼릭 링크면 가리키는 파일의 경로를 -> 뒤에 표시합니다. |
-u |
정렬(-t와 함께)이나 표시(-l과 함께)에 마지막 수정 시각 대신 마지막 접근 시각을 씁니다. -t나 -l과 함께 쓰지 않으면 효과가 없습니다. |
-x |
여러 열 형식으로, 가로 방향으로 정렬해 출력합니다. |
-X |
사용자 이름을 표시하는 다른 플래그와 함께 쓰면 긴 사용자 이름을 그대로 출력합니다. 상한은 PdAt·CuAt 객체 클래스의 max_logname ODM 속성이 정하며, 그보다 긴 이름은 max_logname에서 한 글자 뺀 길이로 자릅니다. |
-1 |
한 줄에 항목 하나씩 출력합니다. 출력이 터미널이 아니면 기본입니다. |
-l과 -N에 대한 참고
- 심볼릭 링크 파일은 화살표와 링크 내용이 뒤에 붙습니다.
- 여러 사용자가 소유한 파일이 있는 디렉터리(
/tmp같은)에서ls -l이 느리면mkpasswd명령을 실행해 빠르게 할 수 있습니다. -L과-N을 함께 쓰면 마지막에 쓴 것이 이깁니다. 또 마지막 글자가/(슬래시)인 심볼릭 링크는 어떤 옵션을 쓰든 자동으로 따라갑니다.
-p의 예:
ls -p | pr -5 -t -w80
영어 원문
-A— Lists all entries except . (dot) and .. (dot-dot).-a— Lists all entries in the directory, including the entries that begin with a . (dot).-b— Displays nonprintable characters in an octal (\nnn) notation.-c— Uses the time of last modification of the i-node for either sorting (when used with the-tflag) or for displaying (when used with the-lflag). This flag has no effect if it is not used with either the-tor-lflag, or both.-C— Sorts output vertically in a multicolumn format. This is the default method when output is to a terminal.-d— Displays only the information for the directory named. Directories are treated like files, which is helpful when using the-lflag to get the status of a directory.-e— Displays the mode (including security information), number of links, owner, group, size (in bytes), time of last modification, and name of each file. If the file is a special file, the size field contains the major and minor device numbers. If the file is a symbolic link, the path name of the linked-to file is printed preceded by a -> (minus, greater than) sign. The attributes of the symbolic link are displayed.-E— Lists extent attributes of a file that exists in Vxfs file systems, such as space reservation, fixed extent size, and extent allocation flag information. You must specify the-lflag with this flag; otherwise, the ls command ignores the-Eflag and completes the execution.-f— Lists the name in each slot for each directory specified in the Directory parameter. This flag turns off the-l,-t,-s, and-rflags, and turns on the-aflag. The order of the listing is the order in which entries appear in the directory.-F— Puts a / (slash) after each file name if the file is a directory, an*(asterisk) if the file can be executed, an = (equal sign) if the file is a socket, a|(pipe) sign if the file is a FIFO, and an @ for a symbolic link. Symbolic links that are named as operands are not followed unless you have specified the-Hor-Lflag.-g— Displays the same information as the-lflag, except the-gflag suppresses display of the owner and symbolic link information.-H— If a symbolic link referencing a file of type directory is specified on the command line, the ls command shall evaluate the file information and file type to be those of the file referenced by the link, and not the link itself; however, the ls command shall write the name of the link itself and not the file referenced by the link.-i— Displays the i-node number in the first column of the report for each file. If the file system has an internal snapshot, the .snapshot directory and all its contents do not have unique i-node numbers.-k— Sets the block size for-soption and the per-directory block count written for-l,-n,-g, and-ooptions to 1024 bytes.-L— Lists the file or directory contents that the link references. This is the default action. Symbolic links are followed. If the-loption is used, the-Noption becomes the default, and no symbolic links are followed. When the-loption is used, only the-Loption can override the-Ndefault.-l— (Lower case L) Displays the mode, number of links, owner, group, size (in bytes), and time of last modification for each file. If the file is a special file, the size field contains the major and minor device numbers. If the time of last modification is greater than six months ago, the time field is shown in the format month date year where as files modified within six months the time field is shown as month date time format. If the file is a symbolic link, the path name of the linked-to file is printed preceded by a ->. The attributes of the symbolic link are displayed. The-n,-g, and-oflag overrides the-lflag. Notes: 1. A symbolically linked file is followed by an arrow and the contents of the symbolic link. 2. The performance of the ls command when used with the-loption can be improved by executing the mkpasswd command. This is helpful when a directory contains files owned by different users, such as the /tmp directory.-m— Uses stream output format (a comma-separated series).-n— Displays the same information as the-lflag, except that the-nflag displays the user and the group IDs instead of the user and group names.-N— Does not follow symbolic links when determining the status of a file. Note: If both the-Land-Noptions are used, the last one will dominate. Also, any time a symbolic link is given that includes a / (slash) as the final character, the link will automatically be followed regardless of any options used.-o— Displays the same information as the-lflag, except the-oflag suppresses display of the group and symbolic link information.-p— Puts a slash after each file name if that file is a directory. This is useful when you pipe the output of the ls command to the pr command, as follows:ls -p | pr -5 -t -w80-q— Displays nonprintable characters in file names as a?(question mark).-r— Reverses the order of the sort, giving reverse alphabetic or the oldest first, as appropriate.-R— Lists all subdirectories recursively.-s— Gives size in kilobytes (including indirect blocks) for each entry.-S— Sorts with the primary key being file size (in decreasing order) and the secondary key being file name in the collating sequence (in increasing order).-t— Sorts by time of last modification (latest first) instead of by name. For a symbolic link, the time used as the sort key is that of the symbolic link itself.-U— Displays similar information as the-lflag. Displays the mode (including security information, named extended attribute information and encryption information), number of links, owner, group, size (in bytes), time of last modification, and name of each file. If the file is a special file, the size field contains the major and minor device numbers. If the file is a symbolic link, the path name of the linked-to file is printed preceded by a->(minus, greater than) sign. The attributes of the symbolic link are displayed.-u— Uses the time of the last access, instead of the time of the last modification, for either sorting (when used with the-tflag) or for displaying (when used with the-lflag). This flag has no effect if it is not used with either the-tor-lflag, or both.-x— Sorts output horizontally in a multi-column format.-X— Prints long user names when used with other flags that display user names. The upper limit is determined by themax_lognameODM attribute in the PdAt and CuAt object classes. If a user name is greater than themax_lognameattribute, it will be truncated to the number of characters as specified by themax_lognameattribute, less one character.-1— Forces output into one-entry-per-line format. This is the default when the output is not directed to a terminal.
종료 상태
| 값 | 뜻 |
|---|---|
| 0 | 모든 파일을 잘 출력했습니다. |
| 0보다 큼 | 오류가 났습니다. |
영어 원문
This command returns the following exit values:
- 0 — All files were written successfully.
>0— An error occurred.
보안
RBAC 사용자와 Trusted AIX 사용자는 주의하세요. 이 명령은 특권 작업을 할 수 있으며, 특권 작업은 특권 사용자만 할 수 있습니다. 이 명령에 걸린 특권과 권한(authorization) 목록은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다. 이 절은 6.1 문서에만 있습니다.
영어 원문
Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.
예제
- 현재 디렉터리의 모든 파일을 나열합니다.
.(점),..(점 두 개), 점으로 시작하는 다른 파일까지 모두 나옵니다.
ls -a
- 자세한 정보를 표시합니다.
chap1과.profile의 긴 목록이 나옵니다.
ls -l chap1 .profile
- 디렉터리 자체의 자세한 정보를 표시합니다. 디렉터리
.과manual, 파일manual/chap1의 긴 목록이 나옵니다.-d가 없으면 디렉터리 자체가 아니라.과manual디렉터리 안의 파일을 나열합니다.
ls -d -l . manual manual/chap1
- 수정 시각 순으로 나열합니다. 가장 최근에 수정한 파일부터 긴 목록으로 표시합니다.
ls -l -t
- 사용자·그룹 이름을 줄이지 않고 자세히 표시합니다.
ls -lX .profile
- 현재 디렉터리의 파일에 확장 속성이 있는지 표시합니다.
ls -U
AIX 5.3 이하의 출력 예:
-rwSr-x---+ 1 root system 28 Apr 29 03:23 only_aixc
-rwSr-x---E 1 root system 4 Apr 29 03:23 only_aixc_ea
-rw-r--r--E 1 root system 4 Apr 29 03:23 only_ea
----------+ 1 root system 265 Apr 29 03:23 only_nfs4
----------E 1 root system 64 Apr 29 03:23 only_nfs4_ea
-rw-r--r--- 1 root system 4 Apr 29 03:23 only_regular
AIX 6.1 이상의 출력 예(암호화된 파일은 e):
-rwSr-x---+ 1 root system 28 Apr 29 03:23 only_aixc
-rwSr-x---E 1 root system 4 Apr 29 03:23 only_aixc_ea
-rw-r--r--E 1 root system 4 Apr 29 03:23 only_ea
----------+ 1 root system 265 Apr 29 03:23 only_nfs4
----------E 1 root system 64 Apr 29 03:23 only_nfs4_ea
-rw-r--r--- 1 root system 4 Apr 29 03:23 only_regular
-rwxrwxr-xe 2 root system 256 May 25 16:27 encry_ex
영어 원문
- To list all files in the current directory, type:
ls -a
This lists all files, including . (dot), .. (dot-dot), and other files with names beginning with a dot.
- To display detailed information, type:
ls -l chap1 .profile
This displays a long listing with detailed information about chap1 and .profile.
- To display detailed information about a directory, type:
ls -d -l . manual manual/chap1
This displays a long listing for the directories . and manual, and for the file manual/chap1. Without the -d flag, this would list the files in the . and manual directories instead of the detailed information about the directories themselves.
- To list the files in order of modification time, type:
ls -l -t
This displays a long listing of the files that were modified most recently, followed by the older files.
- To display detailed information with expanded user and group name, type:
ls -lX .profile
This displays a long listing with detailed information about .profile.
- To display data about whether extended attributes are set for the files in the current directory, type:
ls -U
- For releases AIX 5.3 and earlier: Example output:
-rwSr-x---+ 1 root system 28 Apr 29 03:23 only_aixc
-rwSr-x---E 1 root system 4 Apr 29 03:23 only_aixc_ea
-rw-r--r--E 1 root system 4 Apr 29 03:23 only_ea
----------+ 1 root system 265 Apr 29 03:23 only_nfs4
----------E 1 root system 64 Apr 29 03:23 only_nfs4_ea
-rw-r--r--- 1 root system 4 Apr 29 03:23 only_regular
- For releases AIX 6.1 and later: Example output:
-rwSr-x---+ 1 root system 28 Apr 29 03:23 only_aixc
-rwSr-x---E 1 root system 4 Apr 29 03:23 only_aixc_ea
-rw-r--r--E 1 root system 4 Apr 29 03:23 only_ea
----------+ 1 root system 265 Apr 29 03:23 only_nfs4
----------E 1 root system 64 Apr 29 03:23 only_nfs4_ea
-rw-r--r--- 1 root system 4 Apr 29 03:23 only_regular
-rwxrwxr-xe 2 root system 256 May 25 16:27 encry_ex
파일
| 파일 | 설명 |
|---|---|
/usr/bin/ls |
ls 명령이 들어 있습니다. |
/etc/passwd |
사용자 ID가 들어 있습니다. |
/etc/group |
그룹 ID가 들어 있습니다. |
/usr/share/lib/terminfo/* |
터미널 정보가 들어 있습니다. |
관련 명령어: mkpasswd, find
영어 원문
- /usr/bin/ls — Contains the ls command.
- /etc/passwd — Contains user IDs.
- /etc/group — Contains group IDs.
/usr/share/lib/terminfo/*— Contains terminal information.
Related reference:
- mkpasswd Command
Related information:
- find command
- Files command
- National Language Support Overview for Programming
리눅스(GNU)와 다른 점
| 항목 | AIX 5.3·6.1 | GNU ls |
|---|---|---|
| root의 기본 | root가 실행하면 -A가 기본 |
root여도 숨김 파일을 보이지 않음 |
-e |
모드 뒤에 확장 보안 표시 + |
없음 |
-U |
확장 속성 E·암호화 e 표시 |
정렬하지 않고 디렉터리 순서대로 나열 |
-E |
VxFS 익스텐트 속성(6.1) | 없음 |
-X |
긴 사용자 이름 그대로 표시 | 확장자 순 정렬 |
-N |
심볼릭 링크를 따라가지 않음 | 파일 이름을 따옴표 없이 그대로 표시 |
AIX 5.3·6.1 문서에는 -h(사람이 읽기 쉬운 크기), --color, --time-style 같은 GNU 플래그가 없습니다.