ls

Purpose

Lists the contents of an Oracle ASM directory, the attributes of the specified file, or the names and attributes of all disk groups.

Syntax and Description

ls [--suppressheader] [-lsdtLg][--absolutepath][--reverse]
    [--permission][pattern]

Table 10-35 lists the syntax options for the ls command.


Table 10-35 Options for the ls command

Option Description

(none)

Displays only file names and directory names.

-l

Displays extended file information, including striping and redundancy information and whether the file was system-generated (indicated by Y under the SYS column) or user-created (as with an alias, indicated by N under the SYS column). When used in the "ls -l +" command, displays directory information.

Not all possible file attributes or disk group attributes are included. To view the complete set of column values for a file or a disk group, query the V$ASM_FILE and V$ASM_DISKGROUP views.

-s

Displays file space information.

-d

If the value for the pattern argument is a directory, then ls displays information about that directory, rather than the directory contents. Typically used with another flag, such as the -l flag.

--reverse

Reverses the sort order of the listing.

-t

Sorts the listing by timestamp (latest first) instead of by name.

-L

If the value for the pattern argument is an alias, then ASMCMD displays information about the file that it references. Typically used with another flag, such as the -l flag.

--absolutepath

For each listed file, displays the absolute path of the alias that references it, if any.

-g

GV$ASM_DISKGROUP.INST_ID is included in the output.

--suppressheader

Suppresses column headings.

--permission

Shows the permissions of a file (V$ASM_FILE.permission, V$ASM_FILE.owner, V$ASM_FILE.usergroup, V$ASM_ALIAS.name).

pattern

Name of a file, directory, or a pattern.


Command options enable you to modify and customize the output of the command. Table 10-35 lists the options and their descriptions. For disk group information, this command queries the V$ASM_DISKGROUP_STAT view by default. If you specify all of the options, then the command shows a union of their attributes, with duplicates removed. If you enter ls +, the top level directory structure is displayed.

pattern can be a file name, directory name, or a pattern including wildcard characters. See "Wildcard Characters".

  • If pattern is a directory name, then ls lists the contents of the directory and depending on flag settings, ls also lists information about each directory member. Directories are listed with a trailing slash (/) to distinguish them from files.

  • If the value that you enter for pattern is a file name, then ls lists the file and depending on the flag settings, ls also lists information about the file. The file must be located in the current directory if the file name is specified with a relative path.

Examples

The following are examples of the ls command that display various information about directories and the contents of the directories.

Example 10-44 Using the ASMCMD ls command

ASMCMD [+] > ls +data/orcl/datafile
EXAMPLE.265.691577295
SYSAUX.257.691577149
SYSTEM.256.691577149
UNDOTBS1.258.691577151
USERS.259.691577151

ASMCMD [+] > ls -lt +data/orcl/datafile
Type      Redund  Striped  Time             Sys  Name
DATAFILE  MIRROR  COARSE   JUL 13 08:00:00  Y    EXAMPLE.265.691577295
DATAFILE  MIRROR  COARSE   JUL 13 05:00:00  Y    SYSAUX.257.691577149
DATAFILE  MIRROR  COARSE   JUL 13 02:00:00  Y    USERS.259.691577151
DATAFILE  MIRROR  COARSE   JUL 13 02:00:00  Y    UNDOTBS1.258.691577151
DATAFILE  MIRROR  COARSE   JUL 13 02:00:00  Y    SYSTEM.256.691577149

ASMCMD [+] > ls -l +data/orcl/datafile/sy*
Type      Redund  Striped  Time             Sys  Name
DATAFILE  MIRROR  COARSE   JUL 13 05:00:00  Y    SYSAUX.257.691577149
DATAFILE  MIRROR  COARSE   JUL 13 02:00:00  Y    SYSTEM.256.691577149

ASMCMD [+] > ls -s  +data/orcl/datafile
Block_Size  Blocks      Bytes       Space  Name
      8192   12801  104865792   214958080  EXAMPLE.265.691577295
      8192   88321  723525632  1452277760  SYSAUX.257.691577149
      8192   88321  723525632  1452277760  SYSTEM.256.691577149
      8192    7681   62922752   131072000  UNDOTBS1.258.691577151
      8192     641    5251072    12582912  USERS.259.691577151

ASMCMD [+] > ls --permission  +data/orcl/datafile
User  Group  Permission  Name
              rw-rw-rw-  EXAMPLE.265.691577295
              rw-rw-rw-  SYSAUX.257.691577149
              rw-rw-rw-  SYSTEM.256.691577149
              rw-rw-rw-  UNDOTBS1.258.691577151
              rw-rw-rw-  USERS.259.691577151