SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2012-04-01 01:36:38

awds
Member
Registered: 2012-03-31
Posts: 25

Pruning the Prompt

I've noticed that when using the terminal window to execute commands at the command-line, the command prompt includes the full path. As you can easily imagine, this becomes a real nuisance at lower directory levels. Not only is it a nuisance, it is unnecessary and reminiscent of the user hostility of Microsoft Windows. It is easy to prune the prompt with a simple edit to the command-shell resource configuration file.

To prune the prompt, edit line-55 of the .bashrc file in your home directory and change it from this:

PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

to this:

PS1='${debian_chroot:+($debian_chroot)}\u@\h:$ '

This small change increases the command-line real-estate for useful information. You will note too that the working directory is repeated in the title bar of the terminal window, so there is no need for repetition in the prompt. If you need to know where you are then you can always issue the pwd command; this is especially useful when you are logged-in via a terminal port and don’t have a window title-bar telltale.

Offline

Help fund CrunchBang, donate to the project!

#2 2012-04-01 01:41:47

2ManyDogs
dv#!
From: elsewhere
Registered: 2011-11-22
Posts: 1,346

Re: Pruning the Prompt

Thanks. Why not remove the @\h as well? I can usually remember my host name, and if I forget there's always uname -n smile

Have you seen this thread?

Last edited by 2ManyDogs (2012-04-01 01:46:08)


Be eggsalad to each other.

Offline

#3 2012-04-01 02:46:52

awds
Member
Registered: 2012-03-31
Posts: 25

Re: Pruning the Prompt

That's a good point. The host name is redundant even when logged into another machine as the current host is reported in the title bar of the window, but it is nice to have when working through the regular text terminals. Sometimes I have found myself entering passwords and wondering why I can't do something only to discover that I'm not where I thought I was.

Thanks for the pointer to the other thread; I hadn't seen it.

Offline

#4 2012-04-01 09:13:27

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: Pruning the Prompt

nice tip. there are also options to have the path truncated so it is always of a certain maximum length inside your prompt. i never did this as i agree with you it is already in the titlebar so there's no need for it. just letting people know this is possible. don't know how anymore, you'd have to Google for it.
for those looking to find out more about the prompt, go read this: http://tldp.org/HOWTO/Bash-Prompt-HOWTO/index.html

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo