JP1/Advanced Shell
形式
ls[-1][-A][-a][-C][-c][-d][-F][-f][-g][-h][-i][-k] [-L][-l][-m][-n][-p][-q][-R][-r][-S][-s][-T][-t] [-u][-x][パス名 ...]
機能
ディレクトリの内容を表示します。ディレクトリの内容は標準出力に出力されます。
引数
- -1
- 1行に1エントリ(1列)で出力します。
- -A
- 「.」および「..」を除いてすべてのエントリを出力します。
- -a
- 「.」で始まるファイル名およびディレクトリ名を含めて出力します。
- -C
- 縦方向にソートして,複数列で出力します。端末出力時のデフォルトです。
- -c
- ソート(-tオプション)やリスト出力(-gオプション,-lオプション,-nオプション)のとき,修正時刻ではなく状態変更時刻を使います。
- -d
- ディレクトリの内容を表示しないで,ディレクトリ名を出力します。
- -F
- ディレクトリ名の後ろに「/」,実行可能ファイルの後ろに「*」,シンボリックリンクの後ろに「@」,FIFO名の後ろに「|」,ソケットの後ろに「=」を出力します。
- -f
- ソートをしないで出力します。
- -g
- ロングフォーマットで出力しますが,所有者は出力しません。
- -h
- ロングフォーマット使用時,ファイルサイズを2のべき乗で割って小数点第2位を四捨五入した値をファイルサイズとして出力します。ファイルサイズには,サイズ文字(M:1048576,K:1024)が付加されます。
- ディレクトリ内にスペシャルファイルが存在する場合,-hオプションは無視されます。
- -i
- UNIXの場合,ファイルごとにinode番号を出力します。
- Windowsの場合,常に0を出力します。
- -k
- UNIXの場合,-lオプション,-gオプションおよび-sオプションで出力するディレクトリの合計ブロック数と,-sオプションで表示するファイルサイズをKB単位で出力します。
- Windowsの場合,-sオプションで表示するファイルサイズをKB単位で出力します。
- -L
- UNIXの場合,シンボリックリンクではなく,参照しているファイルの情報を出力します。
- Windowsの場合,常に参照しているファイルの情報を出力します。
- -l
- 次の項目をロングフォーマットで出力します。
- UNIXの場合
アクセス権,ブロック数,所有者名,グループ名,サイズ,修正時刻,ファイル名またはディレクトリ名
- Windowsの場合
ファイル所有者のアクセス権,所有者名,サイズ(ディレクトリの場合は表示しません),修正時刻,ファイル名またはディレクトリ名
- -m
- ファイル名をコンマ(,)で区切って出力します。
- -n
- UNIXの場合,ユーザー名,グループ名の代わりにユーザーID,グループIDを出力します。
- Windowsの場合,ユーザーIDに0を出力します。また,グループIDは出力しません。
- -p
- ディレクトリ名の直後に「/」を出力します。
- -q
- ファイル名に表示できない文字が使われていた場合,代わりに「?」を出力します。端末出力時のデフォルトです。
- -R
- サブディレクトリを再帰的に出力します。
- -r
- 逆順にソートして出力します。
- -S
- サイズでソートして,最も大きいファイルを先頭に出力します。
- -s
- UNIXの場合,ファイルのブロック数を出力します。-kオプションおよび環境変数BLOCKSIZEが定義されていない場合は,512バイトのブロック単位で切り上げて出力します。
- Windowsの場合,ブロック数は常に0と出力されます。
- -T
- 月,日,時間,分,秒,年を含む時間情報を出力します。-gオプション,-lオプションまたは-nオプションのどれかと同時に指定した場合に有効となります。
- -t
- 修正時刻でソートします。最新の修正が先頭になります。
- -u
- ソート(-tオプション)およびリスト表示(-gオプション,-lオプション,-nオプション)の場合,修正時刻ではなく最終アクセス時刻を使用します。
- -x
- 横方向にソートして,複数列で出力します。
- パス名
- 出力するファイル名またはディレクトリ名を指定します。複数指定ができます。
戻り値
戻り値 意味 0 正常終了 1以上 エラー終了
注意事項
- -1オプション,-Cオプション,-lオプション,-mオプションおよび-xオプションは最後に指定したオプションが有効となります。
- -Aオプションの指定の有無に関係なく,常に「.」または「..」を除いたすべてのエントリ(「.」で始まるエントリを含む)が出力対象となります。
- ブロックサイズのデフォルトは512バイトです。
- ファイルの時刻がコマンド実行時刻より182日(約半年)以上昔の場合や,182日以上未来の場合は時刻の代わりに年を表示します。
- Windowsの場合,-Fオプション,-cオプションおよび-uオプションは無視されます。
- Windowsの場合,ユーザー名が取得できない場合は「...」と表示します。
- Windowsの場合,ディレクトリ内のファイルサイズ合計はバイト単位で表示します。
- Windows上で隠しファイル属性の場合も表示対象となります。
- このコマンドは,次の環境変数が有効になります。
- COLUMNS
-Cオプションの指定による,複数列で出力したときの1行当たりの出力幅を定義します。なお,JP1/Advanced Shellのジョブ定義スクリプト内には,定義できません。
- BLOCKSIZE
UNIXの場合,-sオプションの指定で表示する,ブロック数の1ブロック当たりのサイズを定義します。512の倍数で指定します。
- TZ
UNIXの場合,日付時刻の表示に使用されるタイムゾーンを定義します。
Windowsの場合,TZ環境変数の値は日付時刻の表示に影響しません。「日付と時刻のプロパティ」で定義されているタイムゾーンが使用されます。
- Windowsの場合,ドライブレターを指定してディレクトリを参照すると,指定の仕方によってはコマンドを実行しているカレントディレクトリを参照します。
- 例
- カレントドライブ(D:)を指定して,コマンドを実行したカレントディレクトリ(D:\Z)配下の情報を表示します。
- 構成
カレントドライブ 別ドライブ D:\ E:\ │ │ ├X ├R ├Y ├S └Z └T │ │ ├file1 ├fileA ├file2 ├fileB └file3 └fileC D:\Z>ls -l D: total 462 -rw------- ouser001 154 Jun 02 15:23 file1 -rw------- ouser001 154 Jun 02 15:23 file2 -rw------- ouser001 154 Jun 02 15:23 file3 D:\Z>
使用例
- オプションを指定しない場合のデフォルトを表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls cmp.exe grep.exe mv.exe sleep.exe cp.exe hostname.exe spool Adshuxpl.dll date.exe ls.exe rm.exe tmp cat.exe mkdir.exe rmdir.exe uname.exe- -1オプションを指定して,1列で表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -1 Adshuxpl.dll cat.exe cmp.exe cp.exe date.exe grep.exe hostname.exe ls.exe mkdir.exe mv.exe rm.exe rmdir.exe sleep.exe spool tmp uname.exe- -Aオプションを指定して,「.」および「..」を除いたすべてのエントリを表示します。Windowsの場合は,-Aオプションの指定に関係なく「.」で始まるエントリを表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -A abcde.txt date.exe hostname.exe rm.exe uname.exe abcdex.txt ls.exe rmdir.exe Adshuxpl.dll cat.exe file1.txt mkdir.exe sleep.exe abc.txt cmp.exe mv.exe spool abcd.txt cp.exe grep.exe tmp- -aオプションを指定して,「.」で始まるディレクトリを含めて表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -a . cat.exe mv.exe spool .. cmp.exe grep.exe tmp cp.exe hostname.exe rm.exe uname.exe date.exe ls.exe rmdir.exe Adshuxpl.dll mkdir.exe sleep.exe- -Cオプションを指定し,縦方向にソートして複数列で表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -C cmp.exe mkdir.exe rmdir.exe uname.exe cp.exe grep.exe mv.exe sleep.exe Adshuxpl.dll date.exe hostname.exe spool cat.exe ls.exe rm.exe tmp- -fオプションを指定して,ソートをしないで表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -f Adshuxpl.dll cmp.exe mkdir.exe rmdir.exe uname.exe cp.exe grep.exe mv.exe sleep.exe date.exe hostname.exe spool cat.exe ls.exe rm.exe tmp- -gオプションを指定し,所有者表示なしのロングフォーマットで表示します。Windowsの場合はグループ名を表示しません。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -g total 1069363 -rw------- 439808 May 09 11:31 Adshuxpl.dll -rwx------ 10752 May 09 11:34 cat.exe -rwx------ 10240 May 09 11:34 cmp.exe -rwx------ 18432 May 09 11:34 cp.exe -rwx------ 10240 May 09 11:34 date.exe -rwx------ 43008 May 09 11:33 grep.exe -rwx------ 7680 May 09 11:33 hostname.exe -rwx------ 22528 May 09 16:27 ls.exe -rwx------ 8192 May 09 11:33 mkdir.exe -rwx------ 12288 May 09 11:33 mv.exe -rwx------ 16384 May 09 11:33 rm.exe -rwx------ 8192 May 09 11:32 rmdir.exe -rwx------ 8192 May 09 11:32 sleep.exe drwx------ May 10 08:50 spool drwx------ May 10 08:50 tmp -rwx------ 9216 May 09 11:32 uname.exe- -hオプションをロングフォーマットとともに指定して,ファイルサイズにサイズ文字を付加します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -lh total 1069363 -rw------- 10379780 430K May 09 11:31 Adshuxpl.dll -rwx------ 10379780 10.5K May 09 11:34 cat.exe -rwx------ 10379780 10.0K May 09 11:34 cmp.exe -rwx------ 10379780 18.0K May 09 11:34 cp.exe -rwx------ 10379780 10.0K May 09 11:34 date.exe -rwx------ 10379780 42.0K May 09 11:33 grep.exe -rwx------ 10379780 7.5K May 09 11:33 hostname.exe -rwx------ 10379780 22.0K May 09 16:27 ls.exe -rwx------ 10379780 8.0K May 09 11:33 mkdir.exe -rwx------ 10379780 12.0K May 09 11:33 mv.exe -rwx------ 10379780 16.0K May 09 11:33 rm.exe -rwx------ 10379780 8.0K May 09 11:32 rmdir.exe -rwx------ 10379780 8.0K May 09 11:32 sleep.exe drwx------ 10379780 May 10 08:50 spool drwx------ 10379780 May 10 08:50 tmp -rwx------ 10379780 9.0K May 09 11:32 uname.exe- -iオプションを指定して,ファイルごとにinode番号を表示します。Windowsの場合はinode番号に0を表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -i 0 cp.exe 0 hostname.exe 0 rm.exe 0 uname.exe 0 date.exe 0 ls.exe 0 rmdir.exe 0 Adshuxpl.dll 0 mkdir.exe 0 sleep.exe 0 cat.exe 0 mv.exe 0 spool 0 cmp.exe 0 grep.exe 0 tmp C:\TEMP>%ADSH_OSCMD_DIR%\ls -il total 1069363 0 -rw------- 10379780 439808 May 09 11:31 Adshuxpl.dll 0 -rwx------ 10379780 10752 May 09 11:34 cat.exe 0 -rwx------ 10379780 10240 May 09 11:34 cmp.exe 0 -rwx------ 10379780 18432 May 09 11:34 cp.exe 0 -rwx------ 10379780 10240 May 09 11:34 date.exe 0 -rwx------ 10379780 43008 May 09 11:33 grep.exe 0 -rwx------ 10379780 7680 May 09 11:33 hostname.exe 0 -rwx------ 10379780 22528 May 09 16:27 ls.exe 0 -rwx------ 10379780 8192 May 09 11:33 mkdir.exe 0 -rwx------ 10379780 12288 May 09 11:33 mv.exe 0 -rwx------ 10379780 16384 May 09 11:33 rm.exe 0 -rwx------ 10379780 8192 May 09 11:32 rmdir.exe 0 -rwx------ 10379780 8192 May 09 11:32 sleep.exe 0 drwx------ 10379780 May 10 08:50 spool 0 drwx------ 10379780 May 10 08:50 tmp 0 -rwx------ 10379780 9216 May 09 11:32 uname.exe- -lオプションを指定して,ロングフォーマットで表示します。Windowsの場合は,所有者のアクセス権限だけ表示します。グループ名,リンク数およびディレクトリサイズは表示しません。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -l total 1069359 -rw------- 10379780 439808 May 09 11:31 Adshuxpl.dll -rwx------ 10379780 10752 May 09 11:34 cat.exe -rwx------ 10379780 10240 May 09 11:34 cmp.exe -rwx------ 10379780 18432 May 09 11:34 cp.exe -rwx------ 10379780 10240 May 09 11:34 date.exe -rwx------ 10379780 43008 May 09 11:33 grep.exe -rwx------ 10379780 7680 May 09 11:33 hostname.exe -rwx------ 10379780 22528 May 09 16:27 ls.exe -rwx------ 10379780 8192 May 09 11:33 mkdir.exe -rwx------ 10379780 12288 May 09 11:33 mv.exe -rwx------ 10379780 16384 May 09 11:33 rm.exe -rwx------ 10379780 8192 May 09 11:32 rmdir.exe -rwx------ 10379780 8192 May 09 11:32 sleep.exe drwx------ 10379780 May 10 08:50 spool drwx------ 10379780 May 10 08:50 tmp -rwx------ 10379780 9216 May 09 11:32 uname.exe- -lオプションのリスト表示で,-cオプションを指定して修正時刻ではなく状態変更時刻を表示します。Windowsの場合は,-cオプションの指定を無視して修正時刻を表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -lc total 1069363 -rw------- 10379780 439808 May 09 11:31 Adshuxpl.dll -rwx------ 10379780 10752 May 09 11:34 cat.exe -rwx------ 10379780 10240 May 09 11:34 cmp.exe -rwx------ 10379780 18432 May 09 11:34 cp.exe -rwx------ 10379780 10240 May 09 11:34 date.exe -rwx------ 10379780 43008 May 09 11:33 grep.exe -rwx------ 10379780 7680 May 09 11:33 hostname.exe -rwx------ 10379780 22528 May 09 16:27 ls.exe -rwx------ 10379780 8192 May 09 11:33 mkdir.exe -rwx------ 10379780 12288 May 09 11:33 mv.exe -rwx------ 10379780 16384 May 09 11:33 rm.exe -rwx------ 10379780 8192 May 09 11:32 rmdir.exe -rwx------ 10379780 8192 May 09 11:32 sleep.exe drwx------ 10379780 May 10 08:50 spool drwx------ 10379780 May 10 08:50 tmp -rwx------ 10379780 9216 May 09 11:32 uname.exe- -lオプションのリスト表示で,-uオプションを指定して修正時刻ではなく最終アクセス時刻を表示します。Windowsの場合は,-uオプションの指定を無視して修正時刻を表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -lu total 1069363 -rw------- 10379780 439808 May 09 11:31 Adshuxpl.dll -rwx------ 10379780 10752 May 09 11:34 cat.exe -rwx------ 10379780 10240 May 09 11:34 cmp.exe -rwx------ 10379780 18432 May 09 11:34 cp.exe -rwx------ 10379780 10240 May 09 11:34 date.exe -rwx------ 10379780 43008 May 09 11:33 grep.exe -rwx------ 10379780 7680 May 09 11:33 hostname.exe -rwx------ 10379780 22528 May 09 16:27 ls.exe -rwx------ 10379780 8192 May 09 11:33 mkdir.exe -rwx------ 10379780 12288 May 09 11:33 mv.exe -rwx------ 10379780 16384 May 09 11:33 rm.exe -rwx------ 10379780 8192 May 09 11:32 rmdir.exe -rwx------ 10379780 8192 May 09 11:32 sleep.exe drwx------ 10379780 May 10 08:50 spool drwx------ 10379780 May 10 08:50 tmp -rwx------ 10379780 9216 May 09 11:32 uname.exe- -mオプションを指定して,ストリーム出力形式でコンマで区切って表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -m Adshuxpl.dll, cat.exe, cmp.exe, cp.exe, date.exe, grep.exe, hostname.exe, ls.exe, mkdir.exe, mv.exe, rm.exe, rmdir.exe, sleep.exe, spool, tmp, uname.exe- -nオプションを指定して,ユーザー名,グループ名の代わりにユーザーID,グループIDを表示します。Windowsの場合はユーザーIDに0を表示します。また,グループIDを表示しません。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -n total 1069363 -rw------- 0 439808 May 09 11:31 Adshuxpl.dll -rwx------ 0 10752 May 09 11:34 cat.exe -rwx------ 0 10240 May 09 11:34 cmp.exe -rwx------ 0 18432 May 09 11:34 cp.exe -rwx------ 0 10240 May 09 11:34 date.exe -rwx------ 0 43008 May 09 11:33 grep.exe -rwx------ 0 7680 May 09 11:33 hostname.exe -rwx------ 0 22528 May 09 16:27 ls.exe -rwx------ 0 8192 May 09 11:33 mkdir.exe -rwx------ 0 12288 May 09 11:33 mv.exe -rwx------ 0 16384 May 09 11:33 rm.exe -rwx------ 0 8192 May 09 11:32 rmdir.exe -rwx------ 0 8192 May 09 11:32 sleep.exe drwx------ 0 May 10 08:50 spool drwx------ 0 May 10 08:50 tmp -rwx------ 0 9216 May 09 11:32 uname.exe- -pオプションを指定して,ディレクトリの後ろに「/」を表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -p cp.exe hostname.exe rm.exe uname.exe date.exe ls.exe rmdir.exe mkdir.exe sleep.exe cat.exe mv.exe spool/ cmp.exe grep.exe tmp/ C:\TEMP>%ADSH_OSCMD_DIR%\ls -alp total 1069363 drwx------ 10379780 May 10 09:45 ./ drwx------ 10379780 May 10 10:02 ../ -rw------- 10379780 439808 May 09 11:31 Adshuxpl.dll -rwx------ 10379780 10752 May 09 11:34 cat.exe -rwx------ 10379780 10240 May 09 11:34 cmp.exe -rwx------ 10379780 18432 May 09 11:34 cp.exe -rwx------ 10379780 10240 May 09 11:34 date.exe -rwx------ 10379780 43008 May 09 11:33 grep.exe -rwx------ 10379780 7680 May 09 11:33 hostname.exe -rwx------ 10379780 22528 May 09 16:27 ls.exe -rwx------ 10379780 8192 May 09 11:33 mkdir.exe -rwx------ 10379780 12288 May 09 11:33 mv.exe -rwx------ 10379780 16384 May 09 11:33 rm.exe -rwx------ 10379780 8192 May 09 11:32 rmdir.exe -rwx------ 10379780 8192 May 09 11:32 sleep.exe drwx------ 10379780 May 10 08:50 spool/ drwx------ 10379780 May 10 08:50 tmp/ -rwx------ 10379780 9216 May 09 11:32 uname.exe- -qオプションを指定して,表示できない文字を「?」で表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -q ..\dir1 .sub1 file2.txt sub4 wc2.c wc4.c .sub2 sub3 wc1.c wc3.c ????.txt- -Rオプションを指定して,サブディレクトリを再帰的に表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -R ..\dir1 .sub1 file2.txt sub4 wc2.c wc4.c .sub2 sub3 wc1.c wc3.c ????.txt ..\dir1\.sub1: ..\dir1\.sub2: ..\dir1\sub3: ..\dir1\sub4:- -rオプションを指定して,逆順にソートして表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -r spool hostname.exe date.exe Adshuxpl.dll sleep.exe mv.exe grep.exe cp.exe uname.exe rmdir.exe mkdir.exe cmp.exe tmp rm.exe ls.exe cat.exe C:\TEMP>%ADSH_OSCMD_DIR%\ls -rl total 1069363 -rwx------ 10379780 9216 May 09 11:32 uname.exe drwx------ 10379780 May 10 08:50 tmp drwx------ 10379780 May 10 08:50 spool -rwx------ 10379780 8192 May 09 11:32 sleep.exe -rwx------ 10379780 8192 May 09 11:32 rmdir.exe -rwx------ 10379780 16384 May 09 11:33 rm.exe -rwx------ 10379780 12288 May 09 11:33 mv.exe -rwx------ 10379780 8192 May 09 11:33 mkdir.exe -rwx------ 10379780 22528 May 09 16:27 ls.exe -rwx------ 10379780 7680 May 09 11:33 hostname.exe -rwx------ 10379780 43008 May 09 11:33 grep.exe -rwx------ 10379780 10240 May 09 11:34 date.exe -rwx------ 10379780 18432 May 09 11:34 cp.exe -rwx------ 10379780 10240 May 09 11:34 cmp.exe -rwx------ 10379780 10752 May 09 11:34 cat.exe -rw------- 10379780 439808 May 09 11:31 Adshuxpl.dll- -Sオプションを指定して,サイズでソートして最も大きいファイルを先頭に表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -S Adshuxpl.dll rm.exe cmp.exe mkdir.exe ls.exe mv.exe date.exe rmdir.exe spool cat.exe sleep.exe tmp grep.exe cp.exe uname.exe hostname.exe C:\TEMP>%ADSH_OSCMD_DIR%\ls -lS total 1069363 -rw------- 10379780 439808 May 09 11:31 Adshuxpl.dll -rwx------ 10379780 43008 May 09 11:33 grep.exe -rwx------ 10379780 22528 May 09 16:27 ls.exe -rwx------ 10379780 18432 May 09 11:34 cp.exe -rwx------ 10379780 16384 May 09 11:33 rm.exe -rwx------ 10379780 12288 May 09 11:33 mv.exe -rwx------ 10379780 10752 May 09 11:34 cat.exe -rwx------ 10379780 10240 May 09 11:34 cmp.exe -rwx------ 10379780 10240 May 09 11:34 date.exe -rwx------ 10379780 9216 May 09 11:32 uname.exe -rwx------ 10379780 8192 May 09 11:33 mkdir.exe -rwx------ 10379780 8192 May 09 11:32 rmdir.exe -rwx------ 10379780 8192 May 09 11:32 sleep.exe -rwx------ 10379780 7680 May 09 11:33 hostname.exe drwx------ 10379780 May 10 08:50 spool drwx------ 10379780 May 10 08:50 tmp- -sオプションを指定して,ファイルのブロック数を表示します。Windowsの場合は0です。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -sl total 1070036 0 -rw------- 10379780 439808 May 09 11:31 Adshuxpl.dll 0 -rw------- 10379780 90 May 10 10:46 abc.txt 0 -rw------- 10379780 152 May 10 15:25 abcd.txt 0 -rw------- 10379780 179 May 10 11:01 abcde.txt 0 -rw------- 10379780 146 May 10 15:22 abcdex.txt 0 -rwx------ 10379780 10752 May 09 11:34 cat.exe 0 -rwx------ 10379780 10240 May 09 11:34 cmp.exe 0 -rwx------ 10379780 18432 May 09 11:34 cp.exe 0 -rwx------ 10379780 10240 May 09 11:34 date.exe 0 -rw------- 10379780 106 May 10 13:58 file1.txt 0 -rwx------ 10379780 43008 May 09 11:33 grep.exe 0 -rwx------ 10379780 7680 May 09 11:33 hostname.exe 0 -rwx------ 10379780 22528 May 09 16:27 ls.exe 0 -rwx------ 10379780 8192 May 09 11:33 mkdir.exe 0 -rwx------ 10379780 12288 May 09 11:33 mv.exe 0 -rwx------ 10379780 16384 May 09 11:33 rm.exe 0 -rwx------ 10379780 8192 May 09 11:32 rmdir.exe 0 -rwx------ 10379780 8192 May 09 11:32 sleep.exe 0 drwx------ 10379780 May 10 08:50 spool 0 drwx------ 10379780 May 10 08:50 tmp 0 -rwx------ 10379780 9216 May 09 11:32 uname.exe- -Tオプションを指定して,月,日,時間,分,秒,年などの時間情報を表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -lT total 1069363 -rw------- 10379780 439808 May 09 11:31:40 2011 Adshuxpl.dll -rwx------ 10379780 10752 May 09 11:34:28 2011 cat.exe -rwx------ 10379780 10240 May 09 11:34:20 2011 cmp.exe -rwx------ 10379780 18432 May 09 11:34:35 2011 cp.exe -rwx------ 10379780 10240 May 09 11:34:13 2011 date.exe -rwx------ 10379780 43008 May 09 11:33:44 2011 grep.exe -rwx------ 10379780 7680 May 09 11:33:34 2011 hostname.exe -rwx------ 10379780 22528 May 09 16:27:40 2011 ls.exe -rwx------ 10379780 8192 May 09 11:33:15 2011 mkdir.exe -rwx------ 10379780 12288 May 09 11:33:53 2011 mv.exe -rwx------ 10379780 16384 May 09 11:33:01 2011 rm.exe -rwx------ 10379780 8192 May 09 11:32:54 2011 rmdir.exe -rwx------ 10379780 8192 May 09 11:32:49 2011 sleep.exe drwx------ 10379780 May 10 08:50:19 2011 spool drwx------ 10379780 May 10 08:50:19 2011 tmp -rwx------ 10379780 9216 May 09 11:32:44 2011 uname.exe- -tオプションを指定して,修正時刻でソートします。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -t date.exe hostname.exe rmdir.exe spool cp.exe mkdir.exe sleep.exe tmp cat.exe mv.exe uname.exe Adshuxpl.dll ls.exe cmp.exe grep.exe rm.exe C:\TEMP>%ADSH_OSCMD_DIR%\ls -lt total 1069363 drwx------ 10379780 May 10 08:50 spool drwx------ 10379780 May 10 08:50 tmp -rwx------ 10379780 22528 May 09 16:27 ls.exe -rwx------ 10379780 18432 May 09 11:34 cp.exe -rwx------ 10379780 10752 May 09 11:34 cat.exe -rwx------ 10379780 10240 May 09 11:34 cmp.exe -rwx------ 10379780 10240 May 09 11:34 date.exe -rwx------ 10379780 12288 May 09 11:33 mv.exe -rwx------ 10379780 43008 May 09 11:33 grep.exe -rwx------ 10379780 7680 May 09 11:33 hostname.exe -rwx------ 10379780 8192 May 09 11:33 mkdir.exe -rwx------ 10379780 16384 May 09 11:33 rm.exe -rwx------ 10379780 8192 May 09 11:32 rmdir.exe -rwx------ 10379780 8192 May 09 11:32 sleep.exe -rwx------ 10379780 9216 May 09 11:32 uname.exe -rw------- 10379780 439808 May 09 11:31 Adshuxpl.dll- -xオプションを指定し,横方向にソートして複数列で表示します。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -x Adshuxpl.dll cat.exe cmp.exe cp.exe date.exe grep.exe hostname.exe ls.exe mkdir.exe mv.exe rm.exe rmdir.exe sleep.exe spool tmp uname.exe- カレントドライブ(D:\)を指定して,指定したドライブレターの直下(D:\)の情報を表示します。
D:\Z>ls -l D:\ total 0 drwx------ ouser001 Jun 02 15:22 X drwx------ ouser001 Jun 02 15:23 Y drwx------ ouser001 Jun 02 15:25 Z D:\Z>- 別ドライブ(E:)を指定して,指定したドライブレターの直下(E:\)の情報を表示します。
D:\Z>ls -l E: total 0 drwx------ ouser001 Jun 02 15:24 R drwx------ ouser001 Jun 02 15:24 S drwx------ ouser001 Jun 02 15:25 T D:\Z>- 別ドライブ(E:\)を指定して,指定したドライブレターの直下(E:\)の情報を表示します。
D:\Z>ls -l E:\ total 0 drwx------ ouser001 Jun 02 15:24 R drwx------ ouser001 Jun 02 15:24 S drwx------ ouser001 Jun 02 15:25 T D:\Z>- オプションエラーのメッセージを表示します。
- Windowsの例
このメッセージは,コマンドを実行するプラットフォームによって異なる場合があります。
C:\TEMP>%ADSH_OSCMD_DIR%\ls -o ls: illegal option -- o usage: ls [-1AaCcdFfghikLlmnpqRrSsTtux] [file ...]
All Rights Reserved. Copyright (C) 2011, 2012, Hitachi, Ltd.