1
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?

More than 3 years have passed since last update.

【超シンプル備忘録】Linux bash起動時に実行されるファイル

Last updated at Posted at 2021-02-12

ユーザーがログインに成功した後、bashは「ログインシェル」として一般的に以下のような流れでファイルを順次検索し、ファイルが存在していれば実行し起動します。

1. /etc/profileを実行
2. /etc/profileによって、/etc/profile.dディレクトリ配下のすべてのファイルを実行
3. ログインユーザーのホームディレクトリにある̃ /.bash_profileを実行*
4. ̃/.bash_profileによって、̃ /.bashrcを実行
5. ̃/.bashrcによって、/etc/bashrcを実行

 例えば、コマンドラインからのbashの起動、suコマンドで別のユーザーになった場合など、
ログインシェルとしての起動ではない場合は、5のみが実行されます。

1
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
1
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?