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?

ターミナル開始時に特定のディレクトリをデフォルトに設定する方法

Last updated at Posted at 2024-07-13

概要

Linuxでターミナルを開いた際
自動的に特定のディレクトリに移動するよう設定する方法を紹介します。

環境

エディタ:nano
シェル:Bash

手順

1. .bashrc ファイルを開く

ターミナルを開き、以下のコマンドを入力して .bashrc ファイルを編集モードで開きます。

Bash
nano ~/.bashrc

2. ファイルの末尾に移動コマンドを追加

.bashrc ファイルの最後に、cd パス名を追加します。
※ご自身の設定したいパス名

Bash
# 例
cd /home/yourname/vscode/runteq/basic_step/yourproject

screenshot_11.png


3. ファイルを保存して閉じる

①Ctrl+O を押して保存
②エンター
③Ctrl+X を押してエディタを閉じます。


4. 再読み込みして反映

Bash
source ~/.bashrc

5. 元に戻したい場合

①.bashrc ファイルを開く
②.bashrc ファイルの最後に記述したパスを削除
③ファイルを保存して閉じる
④再読み込みして反映

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?