広告

暗号資産取引所の登録特典

登録するだけで受け取れる特典です。条件は各取引所の告知をそのまま載せています。

ls

ファイルとディレクトリ

書き方

ls -la [path]

ディレクトリの中身を一覧します。ドットで始まる名前は -a を付けるまで出てきません。

よく使うオプション

オプション意味
-lOne line per entry with mode, owner, size and time
-aInclude names that begin with a dot
-hSizes as 4.0K instead of 4096, together with -l
-tSort by modification time, newest first
-rReverse whatever order is in effect
-SSort by size, largest first
-RWalk into subdirectories
-dShow the directory itself instead of its contents

例

ls -lh

Long listing with readable sizes.

ls -lat

Newest first, hidden files included.

ls -d */

Only the directories in this folder.

移したり消したり探したりするものです。聞き返してくれない命令が混ざっているので、-i を付ける癖が手を守ります。

読み方

  • 角括弧 [ ] は省いてよい部分です。
  • 三点 … は複数並べられるという意味です。
  • オプションは大文字小文字を区別します — -r と -R が別物のコマンドもあります。

よくある質問

Qls は何をしますか。

ディレクトリの中身を一覧します。ドットで始まる名前は -a を付けるまで出てきません。

Qどう打ちますか。

ls -la [path] — 角括弧は省いてよい部分です。

Qよく使うオプションはいくつですか。

ここにまとめたのは8個です。全部は man ls にあります。このコマンドはファイルとディレクトリの仲間です。

関連するコマンド

man ページ: man ls