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
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:
- How to modify PATH variable for X11 during log-in?Best solution by Super User
- How to create jar file from command line?Best solution by Stack Overflow
- How to align two boxes in a line?Best solution by Stack Overflow
- How to change brightness on Linux desktop through the command line?Best solution by Super User
- How do you clean a dirty anchor line?Best solution by practical-sailor.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.