Use this command to display:
- A list of files or directories
- Information about a file
- Information about a directory as well as all the files and subdirectories
under that directory.
Requirements and Restrictions
- The parameters for this command are case-sensitive. You
must enter the parameters exactly as shown in the syntax
diagram.
- You can enter this command only in CRAS state or higher.
Format
- -a
- lists all entries including those that start with a period (.),
which are referred to as hidden files.
- -C
- displays the list in a multiple column format.
- -d
- displays information about the specified directory itself instead of
information about the files and subdirectories under that directory.
- -F
- indicates the file characteristics by putting one of the following
characters after the file name, if applicable:
- /
- specifies a directory.
- |
- specifies a first-in-first-out (FIFO) special file, which is also referred
to as a named pipe.
- @
- specifies a symbolic link.
- *
- specifies an executable file.
- -i
- displays the file serial (i-node) numbers.
- -l
- displays the attributes of a file or directory in a long format, including
the access permissions, number of links, user ID (UID), group ID (GID), file
size, and time of the last modification. If you specify a directory,
information about every file in that directory (one file per line) is
displayed.
- -q
- displays all nonprintable characters as a question mark (?).
- -R
- recursively displays the contents of the specified directory and all
subdirectories.
- -r
- sorts the list in reverse of the usual order; you can combine this
with other options that specify the sort order of the list.
- -t
- sorts the list by the last modified time stamp.
- -1
- displays the list in a single-column format.
- path
- is the path name of the file or directory whose contents you are
displaying. If you do not specify this parameter, the contents of the
current working directory are displayed.
Additional Information
- Online help information is available for this command. To display
the help information, enter one of the following:
ZFILE HELP ls
ZFILE HELP
ZFILE ?
In addition, the correct command syntax is displayed if you enter the syntax
incorrectly.
- If you do not specify any parameters, only the file names are
displayed.
- If you specify more than one parameter, you can specify these parameters
separately or together. For example, you can enter one of the
following:
- ZFILE ls -l -a path
- ZFILE ls -la path
- If you specify parameters that are mutually exclusive (for example, -C and
-l), the parameter that you specify last on the command is used.
The following parameters are mutually exclusive:
- -R and -d
- -C and -l
- -C and -1
- You can use a vertical bar, or pipe (|), to direct data so the output from
one process becomes the input to another process. This type of one-way
communication allows you to combine ZFILE commands on one line to create a
pipeline. For example, the following pipeline uses the standard output
(stdout) stream from the ZFILE ls command and redirects it to the
standard input (stdin) stream of the ZFILE grep command to search
for those lines containing the word Jan.
ZFILE ls -l | grep Jan
The result is filtered output from the ZFILE ls command displaying only
the lines containing the word Jan in any position.
You can use pipes only with a combination of ZFILE commands where the
command on the left-hand side of the pipe provides data through
stdout and the right-hand side accepts data through
stdin.
- This command does not read from the standard input (stdin)
stream.
You can redirect the standard output (stdout) stream from the
display terminal to a file by specifying one of the redirection characters
(> or >>) followed by the file name to which you want
the output written. The > character writes the output to a
file. The >> character appends the output to an existing
file.
You can redirect the standard error (stderr) stream from the
display terminal to a file by specifying one of the redirection characters
(2> or 2>>) followed by the file name to which you want
the error output written. The 2> character writes the error
output to a file. The 2>> character appends the error output
to an existing file.
- Note:
- When you use the > or 2> character, if the file that
you are redirecting data to already exists, the file is overwritten and any
data in that file is lost. If you do not want to overwrite the file,
ensure that you use the >> or 2>> character.
- The ZFILE ls command is based on the ls utility of the Portable Operating
System Interface for Computer Environments (POSIX) standards.
- You can use the following wildcard characters in the path name to select
files that satisfy a particular name pattern:
- Wildcard
- Description
- *
- Matches any string, including the empty string.
- ?
- Matches any single character.
- [..]
- Matches any one of the characters between the brackets. You can
specify a range of characters by separating a pair of characters with a dash
(-).
- This command supports the following three quoting mechanisms, which allow
you to override the special meaning of some characters:
- escape character (\)
- preserves the literal value of the character that follows. To
ignore the special meaning of a character, escape it by placing a backslash
(\) in front of it. In the example that follows, environment
variable PATH is /bin:/usr/bin:., the first
dollar sign ($) is escaped because of the preceding backslash, and the
second dollar sign takes on a special meaning.
User: ZFILE echo \$PATH is $PATH
System: $PATH is /bin:/usr/bin:.
- single quotation marks (' ')
- preserves the literal value of all characters between the opening single
quotation mark and the closing single quotation mark. For example,
entering ZFILE echo '*' displays an asterisk
character (*). Without the single quotation marks, the files
in the current working directory are displayed.
- double quotation marks (" ")
- preserves the literal value of all characters between the opening double
quotation mark and the closing double quotation mark except the dollar sign
($), the backquote (`), and the backslash (\).
This allows you to use the escape character inside double quotation marks,
which you cannot do in single quotation marks.
For example, entering ZFILE echo "\$PATH is \"$PATH\""
displays $PATH is "/bin:/usr/bin:."
If you want to use the literal meaning of any of the following
characters, you must always use a quoting mechanism:
left angle bracket (<)
| right angle bracket (>)
| ampersand (&)
|
backquote (`)
| backslash (\)
| dollar sign ($)
|
double quotation mark (")
| new-line (\n)
| left parenthesis ( ( )
|
right parenthesis ( ) )
| semicolon (;)
| single quotation mark (')
|
blank space
| tab
| vertical bar (|)
|
In addition, use a quoting mechanism when any of the following characters are
used in a way that takes on a special meaning but you want to use the literal
meaning:
asterisk (*)
| equal sign (=)
| left square bracket ( [ )
|
number sign (#)
| question mark (?)
| tilde (~)
|
Examples
The following example lists the contents of the /tmp
directory.
+--------------------------------------------------------------------------------+
|User: ZFILE ls /tmp |
| |
|System: FILE0001I 13:11:31 START OF DISPLAY FROM ls /tmp |
| dir1 dummy.executable dummy.readonly |
| dir2 dummy.file |
| END OF DISPLAY |
+--------------------------------------------------------------------------------+
The following example lists all the entries in the /tmp
directory, including the hidden files.
+--------------------------------------------------------------------------------+
|User: ZFILE ls -a /tmp |
| |
|System: FILE0001I 13:11:31 START OF DISPLAY FROM ls -a /tmp |
| . dir1 dummy.executable dummy.readonly|
| .. dir2 dummy.file |
| END OF DISPLAY |
+--------------------------------------------------------------------------------+
The following example lists the attributes of all the files and
subdirectories in the /tmp directory using the long format
(-l). The first line of the display shows the total number of file
system blocks occupied by files in the directory. The remainder of the
display contains the following information:
- The file type and access permissions:
- The first character identifies the file type as follows:
- -
- Regular file.
- c
- Character special file.
- d
- Directory.
- l
- Symbolic link.
- p
- FIFO special file (or named pipe).
- s
- Socket file type.
- The next 9 characters indicate the access permissions in three groups of
3. The first group of 3 describes owner permissions; the second
describes group permissions; the third describes other
permissions. The following characters can be displayed:
- r
- Permission to read the file.
- w
- Permission to write to the file.
- S
- For owner permissions, the file is not executable (cannot be run) and the
set-user-ID mode is set. For group permissions, the file is not
executable and the set-group-ID mode is set.
- s
- For owner permissions, the file is executable (can be run) and the
set-user-ID mode is set. For group permissions, the file is executable
and the set-group-ID mode is set.
- x
- Permission to execute (or run) the file or search the directory.
- -
- Permission is denied.
- The number of links to the file
- The name of the owner of the file or directory
- The name of the group that owns the file or directory
- For regular files, the size of the file expressed in bytes. For
other kinds of files where the file size cannot be determined, the value is
-1. For directories, the number of entries in the
directory.
- The date and time that the file or directory was created (or for a file,
the date and time the file was last changed)
- The name of the file or directory.
+--------------------------------------------------------------------------------+
|User: ZFILE ls -l /tmp |
| |
|System: FILE0001I 13:11:31 START OF DISPLAY FROM ls -l /tmp |
| total 5 |
| drwxrwxrwx 1 root system 4 May 5 09:30 dir1 |
| drwxrwxrwx 1 root system 3 May 5 09:30 dir2 |
| -rwxr-x--x 1 apache websrvr 12 May 5 09:34 dummy.executable |
| -rwxrwxrwx 1 apache websrvr 12 May 5 09:31 dummy.file |
| -r--r--r-- 1 apache websrvr 12 May 5 09:35 dummy.readonly |
| END OF DISPLAY |
+--------------------------------------------------------------------------------+
The following example lists the attributes for all the files and
subdirectories in the root (/) directory, including the hidden
files. See the previous example for an explanation of the
display.
+--------------------------------------------------------------------------------+
|User: ZFILE ls -la / |
| |
|System: FILE0001I 10.19.37 START OF DISPLAY FROM ls -la / |
| total 6 |
| drwxr-xr-x 0 root bin 6 Jun 1 10:16 . |
| drwxr-xr-x 0 root bin 6 Jun 1 10:16 .. |
| drwxr-xr-x 1 root bin 6 May 29 06:04 dev |
| drwxrwxrwx 1 nobody tpfuser 3 Jun 1 10:16 etc |
| drwxrwxrwx 1 nobody tpfuser 5 Jun 1 10:18 tmp |
| drwxrwxrwx 1 root bin 7 May 29 14:41 usr |
| END OF DISPLAY |
+--------------------------------------------------------------------------------+
The following example lists the file attributes for a file.
+--------------------------------------------------------------------------------+
|User: ZFILE ls -l /tmp/dummy.file |
| |
|System: FILE0001I 13:11:31 START OF DISPLAY FROM ls -l /tmp/dummy.file |
| total 1 |
| -rwxrwxrwx 1 apache websrvr 12 May 5 09:31 dummy.file |
| END OF DISPLAY |
+--------------------------------------------------------------------------------+
The following example lists multiple files and directories.
+---------------------------------------------------------------------------------------------+
|User: ZFILE ls /usr/aa /tmp/dir2 /tmp/dir1/a.html /tmp/dir1 /tmp/dir1/dir2 |
| |
|System: FILE0001I 13:11:31 START OF DISPLAY FROM ls /usr/aa /tmp/dir2 /tmp/dir1/a.ht... |
| /tmp/dir1/a.html /usr/aa |
| |
| /tmp/dir1/: |
| a.html dir2 |
| |
| /tmp/dir1/dir2: |
| a.exe |
| |
| /tmp/dir2: |
| b.html bb.html |
| END OF DISPLAY |
+---------------------------------------------------------------------------------------------+
Related Information