Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
In Debian 8, the tilde ~ denotes the home directory. But in 9, it seems that the home directory is just itself. So, how can I configure such that the home directory is denoted by ~, just as in Debian 8? Below is part of my ~/.bashrc file:
if [ "$color_prompt" = yes ]; then
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
PS1="[\$(date +%m/%d/%Y),\t@\w]\$ "
else
#PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
PS1="[\$(date +%m/%d/%Y),\t@\w]\$ "
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
#PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
PS1="[\$(date +%m/%d/%Y),\t@\W]\$ "
So you are indeed using bash, not other shells, which means you should get tilde expansion on ~.
I assume that "xxxyyy" is the same string as "lovelinux", which is your actual username.
zhiyizhi wrote:/home/lovelinux/
/home/lovelinux
So when you execute `cd ~`, it indeed goes to your home folder. So the bash tilde expansion is working. Can you provide an example that makes you think "the home directory is not ~ anymore"?
[06/26/2017,21:43:41@/home/lovelinux]$ cd Desktop/
[06/26/2017,21:43:49@/home/lovelinux/Desktop]$ cd /
[06/26/2017,21:43:53@/]$ pwd
/
[06/26/2017,21:43:55@/]$ cd ~/Desktop/
[06/26/2017,21:44:00@/home/lovelinux/Desktop]$
zhiyizhi wrote:In Debian 9, the appearance of Mate-terminal is like this:
[06/26/2017,21:43:41@/home/lovelinux]$ cd Desktop/
But I want it to be as this:
20:45:02@~ $ pwd
That is to say, I want terminal not to replace the tilde to $HOME
Arghhh, it took me ~5 minutes to get your point. So you would like to see "~" instead of "/home/lovelinux" in your bash prompt, which should be the normal behaviour according to the documentation. Is this correct?
zhiyizhi wrote:The output is below:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
xxxyyy 9349 0.0 0.0 26996 3420 pts/5 Ss+ 16:10 0:00 bash /home/lovelinux/
/home/lovelinux
According to the links above, the problem is that you have an extra trailing slash in your HOME variable, which could be wrongly set in /etc/passwd or bashrc.
dasein wrote:(1) Kudos to you, orythem27, for figuring it out at all.
Thanks. I guess OP has been giving the forum members a hard time by not emphasizing "PS1" or "prompt", but I totally overlooked that OP had already mentioned setting PS1 in the opening post.
I have solved the problem, by using the method suggested in the thread https://unix.stackexchange.com/question ... 1-variable. I have deleted the redundant slash after the Home directory in /etc/passwd. Of curiosity is that why there is not such a problem in Debian 8, while it is in Debian 9?