Skip to main content
added 1 character in body
Source Link
Michael Durrant
  • 43.7k
  • 72
  • 176
  • 237

Adding in a character return is my main solution to this

So my prompt (which has other stuff too, making it even longer) looks like this:

enter image description here

You'll notice that the $ is getting returned as a new line

I achieve this with

HOST='\[\033[02;36m\]\h'; HOST=' '$HOST
TIME='\[\033[01;31m\]\t \[\033[01;32m\]'
LOCATION=' \[\033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"`'
PS1=$TIME$USER$HOST$LOCATION' \$PS1=$TIME$USER$HOST$LOCATION'\n\$ '

Note that, even though on a separate line, super long directory trees such as

/home/durrantm/Dropbox/96_2013_archive/work/code/ruby__rails are shortened to

/home/durrantm/Dropbox/_/code/ruby__rails

i.e. "top 3 directories /_/ bottom two directories" which is usually what I care about

This will make sure that the line never gets too long due to directory tree length. If you always want the full directory tree just adjust LOCATION, i.e.

LOCATION=' \[\033[01;34m\]`pwd`'

Adding in a character return is my main solution to this

So my prompt (which has other stuff too, making it even longer) looks like this:

enter image description here

You'll notice that the $ is getting returned as a new line

I achieve this with

HOST='\[\033[02;36m\]\h'; HOST=' '$HOST
TIME='\[\033[01;31m\]\t \[\033[01;32m\]'
LOCATION=' \[\033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"`'
PS1=$TIME$USER$HOST$LOCATION' \$ '

Note that, even though on a separate line, super long directory trees such as

/home/durrantm/Dropbox/96_2013_archive/work/code/ruby__rails are shortened to

/home/durrantm/Dropbox/_/code/ruby__rails

i.e. "top 3 directories /_/ bottom two directories" which is usually what I care about

This will make sure that the line never gets too long due to directory tree length. If you always want the full directory tree just adjust LOCATION, i.e.

LOCATION=' \[\033[01;34m\]`pwd`'

Adding in a character return is my main solution to this

So my prompt (which has other stuff too, making it even longer) looks like this:

enter image description here

You'll notice that the $ is getting returned as a new line

I achieve this with

HOST='\[\033[02;36m\]\h'; HOST=' '$HOST
TIME='\[\033[01;31m\]\t \[\033[01;32m\]'
LOCATION=' \[\033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"`'
PS1=$TIME$USER$HOST$LOCATION'\n\$ '

Note that, even though on a separate line, super long directory trees such as

/home/durrantm/Dropbox/96_2013_archive/work/code/ruby__rails are shortened to

/home/durrantm/Dropbox/_/code/ruby__rails

i.e. "top 3 directories /_/ bottom two directories" which is usually what I care about

This will make sure that the line never gets too long due to directory tree length. If you always want the full directory tree just adjust LOCATION, i.e.

LOCATION=' \[\033[01;34m\]`pwd`'
added 6 characters in body
Source Link
Michael Durrant
  • 43.7k
  • 72
  • 176
  • 237

Adding in a character return is my main solution to this

So my prompt (which has other stuff too, making it even longer) looks like this:

enter image description here

You'll notice that the $ is getting returned as a new line

I achieve this with

HOST='\[\033[02;36m\]\h'; HOST=' '$HOST
TIME='\[\033[01;31m\]\t \[\033[01;32m\]'
LOCATION=' \[\033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"`'
PS1=$TIME$USER$HOST$LOCATIONPS1=$TIME$USER$HOST$LOCATION' \$ '

Note that, even though on a separate line, super long directory trees such as

/home/durrantm/Dropbox/96_2013_archive/work/code/ruby__rails are shortened to

/home/durrantm/Dropbox/_/code/ruby__rails

i.e. "top 3 directories /_/ bottom two directories" which is usually what I care about

This will make sure that the line never gets too long due to directory tree length. If you always want the full directory tree just adjust LOCATION, i.e.

LOCATION=' \[\033[01;34m\]`pwd`'

Adding in a character return is my main solution to this

So my prompt (which has other stuff too, making it even longer) looks like this:

enter image description here

You'll notice that the $ is getting returned as a new line

I achieve this with

HOST='\[\033[02;36m\]\h'; HOST=' '$HOST
TIME='\[\033[01;31m\]\t \[\033[01;32m\]'
LOCATION=' \[\033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"`'
PS1=$TIME$USER$HOST$LOCATION

Note that, even though on a separate line, super long directory trees such as

/home/durrantm/Dropbox/96_2013_archive/work/code/ruby__rails are shortened to

/home/durrantm/Dropbox/_/code/ruby__rails

i.e. "top 3 directories /_/ bottom two directories" which is usually what I care about

This will make sure that the line never gets too long due to directory tree length. If you always want the full directory tree just adjust LOCATION, i.e.

LOCATION=' \[\033[01;34m\]`pwd`'

Adding in a character return is my main solution to this

So my prompt (which has other stuff too, making it even longer) looks like this:

enter image description here

You'll notice that the $ is getting returned as a new line

I achieve this with

HOST='\[\033[02;36m\]\h'; HOST=' '$HOST
TIME='\[\033[01;31m\]\t \[\033[01;32m\]'
LOCATION=' \[\033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"`'
PS1=$TIME$USER$HOST$LOCATION' \$ '

Note that, even though on a separate line, super long directory trees such as

/home/durrantm/Dropbox/96_2013_archive/work/code/ruby__rails are shortened to

/home/durrantm/Dropbox/_/code/ruby__rails

i.e. "top 3 directories /_/ bottom two directories" which is usually what I care about

This will make sure that the line never gets too long due to directory tree length. If you always want the full directory tree just adjust LOCATION, i.e.

LOCATION=' \[\033[01;34m\]`pwd`'
added 114 characters in body
Source Link
Michael Durrant
  • 43.7k
  • 72
  • 176
  • 237

Adding in a character return is my main solution to this

Adding in a character return is my main solution to this

So my prompt (which has other stuff too, making it even longer) looks like this:

enter image description here

You'll notice that the $ is getting returned as a new line

I achieve this with

HOST='\[\033[02;36m\]\h'; HOST=' '$HOST
TIME='\[\033[01;31m\]\t \[\033[01;32m\]'
LOCATION=' \[\033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"`'
PS1=$TIME$USER$HOST$LOCATION

Note that, even though on a separate line, super long directory trees such as

/home/durrantm/Dropbox/96_2013_archive/work/code/ruby__rails are shortened to

/home/durrantm/Dropbox/_/code/ruby__rails

i.e. "top 3 directories /_/ bottom two directories" which is usually what I care about

This will make sure that the line never gets too long due to directory tree length. If you always want the full directory tree just adjust LOCATION, i.e.

LOCATION=' \[\033[01;34m\]`pwd`'

Adding in a character return is my main solution to this

So my prompt (which has other stuff too, making it even longer) looks like this:

enter image description here

You'll notice that the $ is getting returned as a new line

I achieve this with

HOST='\[\033[02;36m\]\h'; HOST=' '$HOST
TIME='\[\033[01;31m\]\t \[\033[01;32m\]'
LOCATION=' \[\033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"`'
PS1=$TIME$USER$HOST$LOCATION

Note that, even though on a separate line, super long directory trees such as

/home/durrantm/Dropbox/96_2013_archive/work/code/ruby__rails are shortened to

/home/durrantm/Dropbox/_/code/ruby__rails

i.e. "top 3 directories /_/ bottom two directories" which is usually what I care about

This will make sure that the line never gets too long due to directory tree length.

Adding in a character return is my main solution to this

So my prompt (which has other stuff too, making it even longer) looks like this:

enter image description here

You'll notice that the $ is getting returned as a new line

I achieve this with

HOST='\[\033[02;36m\]\h'; HOST=' '$HOST
TIME='\[\033[01;31m\]\t \[\033[01;32m\]'
LOCATION=' \[\033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"`'
PS1=$TIME$USER$HOST$LOCATION

Note that, even though on a separate line, super long directory trees such as

/home/durrantm/Dropbox/96_2013_archive/work/code/ruby__rails are shortened to

/home/durrantm/Dropbox/_/code/ruby__rails

i.e. "top 3 directories /_/ bottom two directories" which is usually what I care about

This will make sure that the line never gets too long due to directory tree length. If you always want the full directory tree just adjust LOCATION, i.e.

LOCATION=' \[\033[01;34m\]`pwd`'
added 1 character in body
Source Link
Michael Durrant
  • 43.7k
  • 72
  • 176
  • 237
Loading
added 227 characters in body
Source Link
Michael Durrant
  • 43.7k
  • 72
  • 176
  • 237
Loading
Source Link
Michael Durrant
  • 43.7k
  • 72
  • 176
  • 237
Loading