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】ファイル操作(表示確認、権限)

Posted at

目次

1. 現在のディレクトリの場所を確認する(pwd)
2. カレントディレクトリを移動する(cd)
3. ファイルやディレクトリの情報を表示する(ls)
4. ファイルの権限を変更する(chmod)
5. ディレクトリ内の全てのファイル、ディレクトリのグループを変更する(chgrp)
6. ディレクトリ内の全てのファイル、ディレクトリの所有者を変更する(chown)

現在のディレクトリの場所を確認する

実行例
$ pwd

カレントディレクトリを移動する

実行例
$ cd ../

ファイルやディレクトリの情報を表示する

実行例
$ ls -lh

※読みやすい形式で、ファイルの詳細も併せて表示する。

実行結果
-rw-r--r-- 1 username 197613 5.0K Sep  2 09:20 test.log
-rw-r--r-- 1 username 197613 5.3K Aug 28 21:16 test.log.1
-rw-r--r-- 1 username 197613  525 Sep  2 09:06 test.log.2

ファイルの権限を変更する

※0:---、1:--x、2:-w-、3:-wx、4:r--、5:r-x、6:rw-、7:rwx
※パーミッション(ex. drwxr-xr-x)
「1文字目」-:ファイル、d:ディレクトリ、l:シンボリックリンク
「2-4文字目」:所有者
「5-7文字目」:所有グループ
「8-10文字目」その他権限

実行例
$ chmod 777 test.txt

ディレクトリ内の全てのファイル、ディレクトリのグループを変更する

実行例
$ chgrp -R groupname testDir

ディレクトリ内の全てのファイル、ディレクトリの所有者を変更する

実行例
$ chown -R ownerName testDir
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?