How to remove path of my command line?

how to remove path of my command line?

  • When I start to enter in different folder the path is registered in my command line and I don't know how to remove it. I am almost sure my question wasn't clear. An example is always better. Once in home: luiz@feynman:~$ cd Music/ luiz@feynman:~/Music$ cd Beatles/ luiz@feynman:~/Music/Beatles$ cd 17\ Love/ What is annoying me is this :~/Music or ~/Music/Beatles before $. It seems a stupid problem but when I need to enter into many folders is really a big problem. I guess I should change something in my .bashrc, but I don't know what. Thanks

  • Answer:

    look at and edit the value of $PS1. It contains the template for your prompt. Something like '\u@\h \w $ ' is typical, in this the '\w' is a placeholder for the working directory. SettingPS1'\u@\h $ '` would remove the working directory. For full details on how to set PS1, consult the bash man page

ziulfer at Super User Visit the source

Was this solution helpful to you?

Other answers

You can use this prompt for PS1 PS1='\u@\h: $(x=$(pwd); l=${#x}; if [ $l -lt 24 ]; then echo $x; else echo ... ${x: -20};fi;)\$' Just put this at the very end of your .bashrc. From now every time you go to a path with a length greater than 24 it'll show the last 20 characters preceding by .... In fact when we go deep down a directory only the last directories become significant. Because we already know where we started.

Shiplu

Or you could use PROMPT_DIRTRIM to only include the last couple of directories in the prompt.

rlduffy

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.