Skip to content

gth1ago/terminal_edit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Terminal Edit - Linux

To customize your terminal on some GNU/Linux, it is necessary to change the environment variable PS1 in ~/.bashrc

Shell variable

By default, the shell has the PS1 variable, responsible for the environment, with the value of \u@\h:\w$ which show username, hostname, the current working directory and the user privilege.

Since it's a variable in the shell, you can edit it for testing with the bash command.

Example to see PS1

 > echo $PS1
 \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$

Now, to edit, you can change and test your change until you find your favorite.

 > PS1='${debian_chroot:+($debian_chroot)}\[\033[1;31m\]\u\[\033[1;31m\]:\[\033[01;36m\]\w\[\033[00m\] '

It is important to see by detail is it has no space, because it is a bash command, so it must follow the language standard.

Note: This change is temporary, and when closing the terminal will be reset and the variable defined in the .bashrc will remain unchanged.

Suggestions

In examples are listed some PS1 suggestions to use.

Official change

After choosing your variable, you can with your editor of preference, we will use vim, access the file ~/.bashrc, which holds the console settings.

 > vim ~/.bashrc

So, in .bashrc, you can permanently change thePS1,

# ... code

  if [ "$color_prompt" = yes ]; then.
    PS1='$....'    # here
  else
    PS1='$....'    # here
   fi
# ... code

case "$TERM" in
  xterm*|rxvt*)
    PS1='$....'    # here 
    ;;
  *)
    ;;
  esac

Save and done!

Screenshot of suggestions:

1 -

IMG

2 -

IMG

3 -

IMG

4 -

IMG

About

Customized terminal changing the environment variable PS1 in .bashrc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors