Skip to main content
added 48 characters in body
Source Link
Lucas Jones
  • 1.7k
  • 1
  • 11
  • 8

I love chucking as much stuff as I can into my PS1. Some useful things to remember:

\e[s and \e[u save and unsave the cursor position respectively. I use this to create an 'info-bar' at the top of the screen, a couple of lines long, which can fit more stuff. Example:

PS1='\[\e[s\e[7m\e[1;1H\]\w\n\t \j / \! / \#\[\e[u\e[0m\e[33;1m\][\u@\h \[\e[34m\]\W]\[\e[0m\]\$ ' 

Combine with alias clear='echo -e "\e[2J\n"'. Try it out!

Also, the PROMPT_COMMAND variable defines a command to execute before the PS1 every time.

Another one is the bg command. If you forget to put & at the end of a command, just press ^Z and type bg, and it runs in the background.

I love chucking as much stuff as I can into my PS1. Some useful things to remember:

\e[s and \e[u save and unsave the cursor position respectively. I use this to create an 'info-bar' at the top of the screen, a couple of lines long, which can fit more stuff. Example:

PS1='\[\e[s\e[7m\e[1;1H\]\w\n\t \j / \! / \#\[\e[u\e[0m\e[33;1m\][\u@\h \[\e[34m\]\W]\[\e[0m\]\$ ' 

Try it out!

Also, the PROMPT_COMMAND variable defines a command to execute before the PS1 every time.

Another one is the bg command. If you forget to put & at the end of a command, just press ^Z and type bg, and it runs in the background.

I love chucking as much stuff as I can into my PS1. Some useful things to remember:

\e[s and \e[u save and unsave the cursor position respectively. I use this to create an 'info-bar' at the top of the screen, a couple of lines long, which can fit more stuff. Example:

PS1='\[\e[s\e[7m\e[1;1H\]\w\n\t \j / \! / \#\[\e[u\e[0m\e[33;1m\][\u@\h \[\e[34m\]\W]\[\e[0m\]\$ ' 

Combine with alias clear='echo -e "\e[2J\n"'. Try it out!

Also, the PROMPT_COMMAND variable defines a command to execute before the PS1 every time.

Another one is the bg command. If you forget to put & at the end of a command, just press ^Z and type bg, and it runs in the background.

Post Made Community Wiki
Source Link
Lucas Jones
  • 1.7k
  • 1
  • 11
  • 8

I love chucking as much stuff as I can into my PS1. Some useful things to remember:

\e[s and \e[u save and unsave the cursor position respectively. I use this to create an 'info-bar' at the top of the screen, a couple of lines long, which can fit more stuff. Example:

PS1='\[\e[s\e[7m\e[1;1H\]\w\n\t \j / \! / \#\[\e[u\e[0m\e[33;1m\][\u@\h \[\e[34m\]\W]\[\e[0m\]\$ ' 

Try it out!

Also, the PROMPT_COMMAND variable defines a command to execute before the PS1 every time.

Another one is the bg command. If you forget to put & at the end of a command, just press ^Z and type bg, and it runs in the background.