首页 > 系统相关 >修改linux shell 提示符

修改linux shell 提示符

时间:2023-03-15 18:06:37浏览次数:39  
标签:profile shell 4.1 spark0 hadoop linux home 提示符 bash


远程登录虚拟机,linux shell提示符为-bash-4.1$
要把这个提示符改掉
 
1、新建~/.bash_profile文件
-bash-4.1$ vi ~/.bash_profile
-bash-4.1$ cat  ~/.bash_profile
cat: /home/hadoop/.bash_profile: No such file or directory
提示 权限不够,不能保存

查看用户
-bash-4.1$ whoami
hadoop

-bash-4.1$ pwd
/home/hadoop

修改权限
-bash-4.1$ sudo chmod 777 /home/hadoop

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for hadoop:
hadoop is not in the sudoers file.  This incident will be reported.

 

2、使用root用户,对/home/hadoop开放访问权限,ok
-bash-4.1$ su
Password:
[root@spark0 hadoop]# sudo chmod 777 /home/hadoop
[root@spark0 hadoop]# exit

3、修改~/.bash_profile文件

-bash-4.1$ vim ~/.bash_profile
加上
export PS1='[\u@\h \W]\$'

4、文件生效
-bash-4.1$ source ~/.bash_profile
 
5、现在的提示符是这样的,ok

-bash-4.1$ source ~/.bash_profile
[hadoop@spark0 ~]$pwd
/home/hadoop
[hadoop@spark0 ~]$cd /home/hadoop
[hadoop@spark0 ~]$ls

标签:profile,shell,4.1,spark0,hadoop,linux,home,提示符,bash
From: https://blog.51cto.com/u_10561036/6123164

相关文章

  • 浅谈Linux下的shell--BASH
    shell的概念与作用我们已经学习并知道了操作系统实际上就是一款软件,一款用来管理计算机软硬件资源,为用户提供良好的执行环境的软件。假如该软件能被用户随意操作,就会有可能......
  • linux系统如何查看是否是线程死锁,多线程中如何使用gdb精确定位死锁问题
    在多线程开发过程中很多人应该都会遇到死锁问题,死锁问题也是面试过程中经常被问到的问题,这里介绍在c++中如何使用gdb+python脚本调试死锁问题,以及如何在程序运行过程中......
  • Linux开启root用户远程登录
    Linux开启root用户远程登录开启root账户,给root用户设置密码sudopasswdroot输入两遍密码修改配置文件打开SSH配置文件。vim/etc/ssh/sshd_config修改如下参......
  • linux自定义man搜索路径
    很多时候,在linux我们源码编译库代码时候会自定义安装路径,这使得man查询的时候无法找到库文档,默认的man搜索路径可以使用下面命令查看:$man-w/usr/local/share/man:/usr/......
  • Linux基础
    常用命令cd  :  切换文件夹  cd/home 绝对路径,以根目录开头  cd admin 相对路径,  cd..返回上一层目录  cd~回到自己家目录  cd-回看......
  • Linux下文档的压缩与打包
    Linux下最常见的压缩文件通常都是.tar.gz格式的,除此之外还有.tar、.gz、.bz2、.zip下面介绍Linux下最常见的后缀名所对应的压缩工具:.gz:表示由gzip压缩工具压缩的文件。......
  • Linux进程通信 | 管道与FIFO
    Linux进程间通信通常使用的方式有很多种,其中比较常用的包括管道(pipe)和FIFO(命名管道)。本文将介绍这两种通信方式的基本概念,并用C语言编写示例代码,来说明如何在两个进程之间......
  • 强大的iptables:解锁Linux网络安全的神器
    iptables是Linux系统中的防火墙管理工具,它的功能强大并且使用灵活,可用于网络防护、路由转发等功能应用。由于防火墙功能是基于Linux内核实现的,具有稳定和高效率的特点,因此常......
  • linux服务器检查脚本
    直接上脚本该脚本并不能检测出服务器有什么性能问题,或者安全问题,只是简单的展示检查结果,至于服务器是否有什么问题,还需要执行者自行根据结果去分析,判断。具体内容,如下,有详细......
  • Linux系统中多线程实现方法的全面解析
    ​线程引入:     在传统的Unix模型中,当一个进程需要由另一个实体执行某件事时,该进程派生(fork)一个子进程,让子进程去进行处理。Unix下的大多数网络服务器程序都是这么......