0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【備忘録】lsコマンドのよく使うオプションまとめ

Posted at

Linux作業中に頻繁に使う ls コマンド。
オプションが多く、毎回「あれ何だっけ?」となるので備忘録としてまとめる。
また、今後新しいオプションの組み合わせに出会ったら追記していく。

ls とは

ディレクトリ内のファイル・ディレクトリを一覧表示するコマンド。

$ ls

基本オプション

-l(long format)

詳細情報付きで表示する。

$ ls -l

表示内容:

  • パーミッション
  • ハードリンク数
  • 所有ユーザー / グループ
  • ファイルサイズ
  • 更新日時
  • ファイル名

-a(all)

.(カレント)や ..、隠しファイル(.始まり)も含めて表示。

$ ls -a

並び替え系オプション

-t(time)

更新日時(mtime)順で表示(新しいものが先)。

$ ls -lt

-r(reverse)

並び順を逆にする。

ls -ltr

→ 更新日時が古い順になる

よく使う組み合わせ

$ ls -ltr
  • 詳細表示
  • 更新日時順
  • 古いもの → 新しいもの
    ログ確認などでよく使う。
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?