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?

[Linux][command] ディレクトリ・ファイル管理_表示_ls, stat, less, more, file

Last updated at Posted at 2025-04-12

lsコマンド

$ ls [オプション] ファイル名
オプション 由来 説明
default list - 指定したファイルやディレクトリを一覧表示
-a all - 隠しファイル(.で始まるファイル)を含め、すべてのファイルを表示
-d directory - ディレクトリの中身ではなく、そのものを表示
(例:ls -d /etc
-i inode - 各ファイルのinode番号を表示
-l long format - 詳細情報を表示
(パーミッション、所有者、サイズ、更新日時など)
-F file type - 各ファイルの種類を表示
(末尾に/:ディレクトリ、*:実行可能ファイルなど)
-R recursive - サブディレクトリも含めて再帰的に内容を表示

statコマンド

$ stat [オプション] ファイル名  
オプション 由来 説明
default status - 詳細情報を表示
(サイズ、タイムスタンプ、パーミッション、inode番号など)
-t terse - 簡潔形式で情報を表示(スクリプト向け)

lessコマンド

$ less [オプション] ファイル名
オプション 由来 説明
default less - ファイルの内容をページ単位で表示(双方向スクロール可)
- / で検索、 PgUp PgDn で移動可能
-N number - 各行の行番号を表示する
+F follow - tail -f のように、ファイルの更新をリアルタイムに追跡表示
-S chop long lines - 長い行を折り返さずに右にスクロールして表示する

fileコマンド

$ file [オプション] ファイル名
オプション 由来 説明
default なし - 指定されたファイルの種類(テキストファイル、バイナリファイルなど)を表示する
-i mime-type - MIMEタイプ(ファイルの種類)を表示する
-b brief - ファイルタイプの出力を簡潔に表示(ファイル名を除く)
-f file list - 指定したファイルリストから、複数のファイルのタイプを調べて出力する
-z compressed - 圧縮されたファイルも展開してタイプを表示する
-m magic file - 特定のマジックファイルを使用してファイルタイプを判定する

Ping-t

ls

stat

less, more

file

0
0
2

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?