SOLVED:How to get the full path in Manjaro's Terminal as Ubuntu's Terminal does?


Tips for posting

Use a "keyword search" to make sure your question has not already been asked. For example "failed to verify key" or "sound is muted".

Make sure you include enough detail so people know what you are running. A useful command is inxi -Fxz; copy and paste the text and format as "code" (e.g. use the </> button above).

If possible, paste text rather than upload a photo. Text is easier to read, searchable, and takes up less space on the server. Please don't upload high-resolution photos.

For more information read this post: How to provide good information in your posts

Remember to remove all of this help text before you post.


You mean this:
[User: jan] @ [Server: Manjaro-Unstable] - [Directory: /etc/default]
$
Or do you mean at the top of the window?

, I have just installed and updated Manjaro from manjaro-gnome-17.1.10-stable-x86_64.iso. My system is now
Gnome Version 3.28.2
Memory 3.6 GiB
_Processor Intel® Core™ i3-2328M CPU @ 2.20GHz × 4 _
Graphics Intel® Sandybridge Mobile
OS Name Manjaro Linux
OS Type 64-bit
Disk 29.8 GB
uname -a: Linux -pc 4.14.48-2-MANJARO #1 SMP PREEMPT Fri Jun 8 20:41:40 UTC 2018 x86_64 GNU/Linux
When I use the Gnome Terminal is does not list the full path of a directory tree across a different partition, e.g.,

[<name>@<name>-pc WinLin]$

while the Gnome Terminal in Ubuntu Gnome yields the full pathname, i.e.,

<name>@<name>: /media/<name>/WinLin$

How can I get the same result in Manjaro's Gnome Terminal, please?

Thanks, manjacub

P.S. Manjaro Gnome Terminal is Gnome Terminal 28.2, Ubuntu Gnome 18.4 Terminal is 3.28.1
P.P.S. Even Debian Gnome 9 Stretch has for me the "right" ternal.

Sorry, I am not familiar with Gnome. Googled it and found this:
https://www.davidpashley.com/articles/bash-prompts/
Have a look to see if you can get it the way you want it.

1 Like

Sorry, I should have uploaded two screenshots! Here they are:

This is when I use Ubuntu (or Debian) and work with file manager to partition WinLin (same HDD) and its folder "BackupUbuntuSystems". Then I "open in terminal" and get the terminal as shown.
UbuntuTerminalB
I mark the line with left mouse (omitting the 'xyz@xyt:' part) and can paste with middle.mouse-click wherever I want to. Very convenient, e.g., when using rsync.

And this with Manjaro, same partition, same folder tree:
ManjaroTerminalB
Very inconvenient :frowning:

I got that. Just look at the page I sent you. Somewhere in the middle you find 2 lines with directory settings:
W (capittal letter) shows only the last part of the directory
w (small letter) shows the full path.
The prompt can be changed in the .bashrc file. You will see some lines there which start with PS1=
In those lines you change the W into a w.
Save the file and relog-in or in a terminal type:

source .bashrc

2 Likes

Look in this book:

https://sourceforge.net/projects/linuxcommand/files/TLCL/17.10/

2 Likes

Thank you for your comments!
I am not export enough to understand why Manjaro would hide the full path in a terminal, contrary to debian, Ubuntu, and , if I recall my eplorations into other Linux distros correctly, Fedora and OpenSuse.
Since I am also having problems with Thunderbird in Manjaro, I consider it an interesting learning experience and say bye-bye for now.

1 Like

Did you manage to get it right now? If so, then please mark the tickbox in the post with the right answer to indicate that the question is answered and this is the answer.

different users - different requirements

A long prompt because you a inside a deep folder structure is more inconvenient than a prompt showing your actual folder.

You will always be able to get your exact path using this simple echo $PWD
You could also create an alias whereami=echo $PWD

Edit: I don't know why my echo $PWD don't echo the path - scripting it is working - use pwd @DeMus showed me :slight_smile: :+1:

1 Like

Just typing

pwd

is already enough.

2 Likes

Here it is working, so must be something in your setup. :wink:

~/Data >>> which pwd                                                                                                 
pwd: shell built-in command

pwd is built-in shell command - I am using zsh - is it also present in bash?

EDIT: indeed it is - it is the alias which is not working as expected - something to read up on :slight_smile:

EDIT: alias whereami="echo $PWD" - so I forgot the double qoutes

Please remember the XY problem description and don't expect all linux distros to behave completely identical.

Thank you,
pwd
works fine, but as I said Manjaro was an interesting learning experience for me but I prefer my previous distros.

Is it because of not having the full path ootb in a Manjaro terminal while other distro's do have that? We helped you find the solution for that, the problem is solved so why leave? Not having everything as you want it to be is part of the fun, at least for many. If that's not your ballgame then yes, find a distro which suits each and every need you might have. I wish you lots and lots of success in finding one, you sure gonna need it.

I think an export would not regard it a showstopper as not to have the full path in a terminal prompt.

short answer. do this in your terminal:

OLD_PS1=$PS1; PS1=${PS1/\W/\w}

you will immediately get a prompt with the full path (do not run the OLD_PS1=$PS1 part again before reading on).

long answer. linux shell keeps the format of the prompt in a text variable PS1, check the current format:

echo $PS1

this will show you something like this (the default manjaro prompt):

[\u@\h \W]\$

to your shell this means: show a bracket [, then username (\u), then @, than hostname (\h), then space ( ), then short path (\W), and finally the prompt itself ($ or # depending on user).

to change your prompt, you give this variable a new text that your shell will understand, check this article for details: How to: Change / Setup bash custom prompt (PS1) (or search the internet for "shell custom prompt PS1 -powershell"). in your case, you'd only need to change the \W part into \w (full path).

the command i proposed above:

OLD_PS1=$PS1; PS1=${PS1/\W/\w}

  1. saves your current prompt format in a variable OLD_PS1 so that you can restore it later (unless you run this command several times, of course): OLD_PS1=$PS1
  2. replaces all \W in your prompt with \w to give you full path (\w) instead of just the last dir (\W): $PS1/\W/\w
  3. and saves this revised format to the variable PS1: PS1=...

however after reboot/relogin your prompt will once again contain the short path. why? because the PS1 variable will be empty and the shell will read it anew from the .bashrc file in your home directory, check it out:

cat ~/.bashrc

you could easily edit this file to get whatever prompt you want. however being a beginning linux user you'd probably break your config a couple of times before getting it right... so the most simple thing to do is...

just add the command i proposed above as the last line to your .bashrc with a text editor:

OLD_PS1=$PS1; PS1=${PS1/\W/\w}

save it, close the editor and force the shell to re-read it's configuration (or just logout/login, or reboot):

source ~/.bashrc

you'll immediately get your prompt with the full path and it will stay like that after logouts/reboots.

p.s. you'll enjoy your linux experience with any distro much, much more if you love learning new things daily instead of trying to find a distro that has everything just right for you.

2 Likes

Does not work for me - shows only the last part of the path; eg ~ or home.

Forum kindly sponsored by