---
title: "Discussion on \"bash下变量PS1的完整理解\" | Hashnode"
description: "Discussion on \"bash下变量PS1的完整理解\". 本文并不会讲解如何设置PS1以获得你喜欢的提示符；本文会围绕PS1这个变量，就其涉及到的一些概念展开讨论\n1. 导言\n\nubuntu 的默认 shell 是 bash，bash 下有个变量 PS1，我们在 linux 的终端上用这个变量来设置命令行界面的提示符，这是一件很平常的事情\n\n很多很多文章在提到 PS1 时都称其为环境变量，但是有一天我使用 env 显示环境变量时却发现并没有 PS1，用 printenv 也是一样，认真分析了一下 PS1，觉着可以写一篇文章\n\n关于 Linux 下设置 ..."
url: "https://hashnode.com/posts/100004-setup-ps1/6350fe79b25ce753f76e4f4b"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [bash下变量PS1的完整理解](https://whowin.cn/100004-setup-ps1?utm_source=hashnode&utm_medium=feed)

本文并不会讲解如何设置PS1以获得你喜欢的提示符；本文会围绕PS1这个变量，就其涉及到的一些概念展开讨论 1. 导言 ubuntu 的默认 shell 是 bash，bash 下有个变量 PS1，我们在 linux 的终端上用这个变量来设置命令行界面的提示符，这是一件很平常的事情 很多很多文章在提到 PS1 时都称其为环境变量，但是有一天我使用 env 显示环境变量时却发现并没有 PS1，用 printenv 也是一样，认真分析了一下 PS1，觉着可以写一篇文章 关于 Linux 下设置 ...

Apr 17, 2022 · 10 min read · whowin.cn  
Updated Oct 18, 2024  
Read the article

-   [#linux](https://hashnode.com/tag/linux)
-   [#shell](https://hashnode.com/tag/shell)
-   [#environment-variables](https://hashnode.com/tag/environment-variables)
-   [#bash](https://hashnode.com/tag/bash)
-   [#ps1](https://hashnode.com/tag/ps1)

## Written by

[whowin](https://hashnode.com/@whowin)

@whowin · Beijing, China

  
[View profile](https://hashnode.com/@whowin)

一枚有30多年经验的退休程序员，主要从事嵌入式软件开发

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
