You are Here:
Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section



Changing loging shell and/or terminal prompt

Author (Read 18559 times)

0 Members and 2 Guests are viewing this topic.

Re: Changing loging shell and/or terminal prompt
« Reply #3 on: June 26, 2019, 08:27:21 PM »
 

Jerry

  • Linux Lite Creator
  • Administrator
  • Platinum Level Poster
  • *****
  • 8775
    Posts
  • Reputation: 801
  • Linux Lite Member
    • View Profile
    • Linux Lite OS

  • CPU: Intel Core i9-10850K CPU @ 3.60GHz

  • MEMORY: 32Gb

  • VIDEO CARD: nVidia GeForce GTX 1650

  • Kernel: 5.x
Paste your .bashrc please.
 

Re: Changing loging shell and/or terminal prompt - does not work
« Reply #2 on: June 26, 2019, 07:57:43 PM »
 

thomasd

  • New to Forums
  • *
  • 3
    Posts
  • Reputation: 0
  • Linux Lite Member
    • View Profile

  • CPU: VM
I've started using Linux Lite and the "pretty" bash prompt is driving me crazy because I cannot change it.

The instructions in this post don't work, no mater what I do, PS1 stays set.
Code: [Select]
 thomasd  ~  PS1="Foo : "
 thomasd  ~  echo $PS1
\[\] thomasd \[\] \[\]~ \[\] \[\]
 thomasd  ~  

doing export has the same effect:
Code: [Select]
 thomasd  ~  export PS1="Foo : "
 thomasd  ~  echo $PS1
\[\] thomasd \[\] \[\]~ \[\] \[\]
 thomasd  ~  
 

Changing loging shell and/or terminal prompt
« Reply #1 on: September 17, 2018, 07:34:48 PM »
 

Moltke

  • Platinum Level Poster
  • **********
  • 1134
    Posts
  • Reputation: 126
  • Linux Lite Member
    • View Profile

  • CPU: amd athlon 64 x2

  • MEMORY: 4Gb

  • VIDEO CARD: amd radeon hd 6750

  • Kernel: 5.x
Hi everyone! Hope you're all having a nice life! :)

Today I'd like to share with you some basics on how to change the login shell and/or terminal prompt. It's a completely and entirely safe procedure which will make no harm to your system, because that's how smart Linux is :) However, if it makes you feel better/safer, you can make a backup of your .bashrc file located in your home folder 
Code: [Select]
$ cp ~.bashrc .bashrc.bak but it's really not neccesary. Like I said, Linux's smart enough not to let you screw things up  ;D

In order to change your login shell simply type in your terminal:

Code: [Select]
$ chsh -l
If the command above doesn't work you may use:

Code: [Select]
$ cat /etc/shells
One or the other  will list all installed/available shells in your system, to change the current shell for one of those available type:

Code: [Select]
$ chsh -s desired shell's name
for example

Code: [Select]
chsh -s /bin/zsh
You'll be asked to type your password, do so then logout/login back, open a terminal and type:

Code: [Select]
echo $SHELL your new shell's name should be displayed. In our example it'd show:

Code: [Select]
$ /bin/zsh


Changing the terminal prompt is quite easy using the command
Code: [Select]
$ PS1=ARGS  for example, this is how my terminal prompt is configured:
Code: [Select]
$ PS1='\[\e[1;36m\][\t \u \[\e[0m\]\W \$]' where; \e= An ASCII escape character (033), 1;36m\= bold font and cyan color, \t= current time, \u= current logged user, \W= current working directory, \$= current prompt symbol.
resulting in this:





However, this is only temporary and it will be back to defaults in your next login, if you want to make it permanent edit your .bashrc file to make it so:
Code: [Select]
$ nano .bashrc #change nano for your preferred editor, i.e; vi and add something like this: export PS1='\[\e[1;36m\][\t \u \[\e[0m\]\W \$] '


Well, that's it. This is the basics for changing the login shell and/or terminal prompt. Here's a couple of links to some very instructional sites/articles on these topics
https://bash.cyberciti.biz/guide/Changing_bash_prompt
https://wiki.archlinux.org/index.php/Command-line_shell#Alternative_shells

Hope you find this helpful! :)
« Last Edit: July 13, 2019, 07:28:03 PM by Moltke »
Without each others help there ain't no hope for us :)
Need a translation service? https://www.deepl.com/es/translator
 

 

-->
X Close Ad

Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section