今回は、CentOS8でlsコマンドの説明します。
説明
lsはファイルやディレクトリを表示するコマンドです。
具体例
# ファイル名やディレクトリ名を表示
[root@CE08PRD103 ~]# ls
anaconda-ks.cfg javasharedresources テンプレート ビデオ 公開
install.log.hinemos_manager test デスクトップ 音楽
(省略)
# ファイルやディレクトリの詳細を表示
[root@CE08PRD103 ~]# ls -l
(省略)
drwxr-xr-x 2 root root 6 9月 13 18:19 ダウンロード
drwxr-xr-x 2 root root 6 9月 13 18:19 テンプレート
(省略)
# ファイルやディレクトリの詳細を表示2
# こっちの方が楽
[root@CE08PRD103 ~]# ll
(省略)
drwxr-xr-x 2 root root 6 9月 13 18:19 ダウンロード
drwxr-xr-x 2 root root 6 9月 13 18:19 テンプレート
(省略)
# 隠しファイルの詳細も表示
[root@CE08PRD103 ~]# ls -la
(省略)
-rw-------. 1 root root 17987 9月 14 00:11 .bash_history
-rw-r--r--. 1 root root 18 5月 12 2019 .bash_logout
(省略)
# ディレクトリの詳細を表示
[root@CE08PRD103 ~]# ls -ld /etc
drwxr-xr-x. 141 root root 8192 9月 15 13:19 /etc
# 更新日付の昇順に表示
# 最近更新したファイルを探すときに便利
[root@CE08PRD103 ~]# ls -lrt
-rw-------. 1 root root 1177 9月 2 00:32 anaconda-ks.cfg
drwxr-xr-x 2 root root 6 9月 13 17:38 test
drwxr-xr-x 2 root root 6 9月 13 18:19 公開
(省略)
lsの表示結果の見方

① ファイルの種類
- ・・・ファイル
d ・・・ディレクトリ
l ・・・シンボリックリンク(Windowsのショートカットファイルみたいなやつ)
② パーミッション
r ・・・読取権(4)(readの略。ファイルを開ける、ディレクトリの一覧を表示できる)
w ・・・書込権(2)(writeの略。ファイルに保存できる、ディレクトリに保存できる)
x ・・・実行権(1)(excuteの略。ファイルを実行できる、ディレクトリに移動できる)

所有者用のパーミッション・・・
このファイル/ディレクトリを所有しているユーザのパーミッション。上記の場合、rootユーザは読取、書込、実行が可能。
所属グループ用のパーミッション・・・
このファイル/ディレクトリのグループに所属しているユーザ用のパーミッション。上記の場合、rootグループに所属しているユーザは、読取、実行が可能。
その他のグループ用のパーミッション・・・
このファイル/ディレクトリのグループに所属していないユーザ用のパーミッション。上記の場合、rootグループに所属しているユーザは、読取、実行が可能。
③ ハードリンクの数
ファイルは1、ディレクトリはサブディレクトリの数ー2。サブディレクトリの数を数が分かる。