Open2

Bash tutorials

英大研究員H英大研究員H

ターミナル内でプロンプトを短縮する方法

How to Shorten Bash Prompt in Linux?
Method 1: Editing bashrc file.
https://techglimpse.com/shorten-bash-prompt-linux/

Step 1:
vim ~/.bashrc (or nano ~/.bashrc)

Step 3:
In PS1 (both within if & else condition)

  • remove ‘@\h‘
  • replace ‘\w‘ with ‘\W‘ (uppercase W)

Step 4:
save file
source ~/.bashrc