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, 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 - サブディレクトリも含めて再帰的に内容を表示する

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

less, more

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?