8

I got the following screenshot from a Spatry linux video from https://www.youtube.com/watch?v=ROyqnJg1Ipo

my command line is usually long. so i prefer whole of current path in 1st line and command prompt in next

I want something like this on every prompt

----[myusername@laptop]------[14:30:44]----/mnt/1CFED66BFED63CA8/router/Documents/hacking/1 set up tools/wifiphisher
==> 
  • i want whole of my current pwd to be displayed in 1st line and prompt me in 2nd line – nazar2sfive Aug 24 '16 at 3:48
  • shorten? That prompt is shorter? – Jason Day Aug 24 '16 at 18:15
  • @Jason Day : although 1st line is longer [and will show you long PWD neatly]... the next line prompt gives you plenty of space ... that is the whole idea – nazar2sfive Aug 25 '16 at 2:18
16

Assuming you're using bash, place a line like:

PS1="----[\u@\H]------[\t]----\w\n==> "

into your ~/.bashrc file, which will set your bash prompt to what you want. If you want to change it further, just consult the page http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html

  • okay, i'll change what's in my answer to reflect the prompt you want – singerng Aug 24 '16 at 3:56
  • okay got it :-P – singerng Aug 24 '16 at 4:13
  • user@machine and time is shown but PWD is not displayed – nazar2sfive Aug 24 '16 at 4:17
  • sigh, changed it one more time – singerng Aug 24 '16 at 4:18
  • 5
    @nazar2sfive Yes, next time try to search for yourself instead of repeatedly asking changes to somebody else. There's plenty of documentation about bash prompts, how to insert various information in various formats, with colors, bold, italics etc. Googleing "Bash prompt generator" yields results like this websites where you can drag&drop the information you want to display with styles etc. It includes a "new line" drag and drop.... in summary: you could just search "bash prompt generator" and obain this answer without having to annoy other people multiple times – Bakuriu Aug 24 '16 at 9:19
8

Though The question is already answered and accepted, but I still want to suggest trying using bash-it.

It has numerous themes, aliases and completion support for several languages and frameworks, including git, rails, svn and many others.

Installation

  1. Download the zip archive from here https://github.com/Bash-it/bash-it/archive/master.zip and extract it in a folder .bash_it. This folder would be a hidden folder for starting with a dot(.).

  2. Run ~/.bash_it/install.sh (it automatically backs up your ~/.bash_profile or ~/.bashrc, depending on your OS)

  3. Edit your modified config ~/.bashrc file in order to customize Bash-it.

    For example if you want to use the Slick theme you'd change the line 8 of ~/.bashrc file to

    export BASH_IT_THEME='slick'
    

The Themes are in ~/.bash_it/themes/ directory.

The available themes screenshot can be viewed here. https://github.com/Bash-it/bash-it/wiki/Themes

Alternatively, you can preview all of them in your shell using the command

 BASH_PREVIEW=true reload

You can start using them by doing command

source ~/.bash_it/themes/<theme-name>/<theme-name>.theme.bash

'bobby' theme has a prompt with time included, try using it. You can also customize them.

  • i think this is the accurate sparty way – nazar2sfive Aug 24 '16 at 6:09
  • Since singerng has given the answer according to your need first, I recommend accepting his answer instead. Also It's kinda hurting changing accept :) An upvote is sufficient for an answer to mark it helpful. Thank you. – Anwar Aug 24 '16 at 6:22
  • 1
    Another package which can provide complex shell prompts (originally conceived for prompts in vim but extended to other applications) is powerline. <powerline.readthedocs.io/en/latest/usage/shell-prompts.html> – J G Miller Aug 24 '16 at 16:15
  • @JGMiller Thanks for this incredible suggestion! is it available as deb package or in github only? – Anwar Aug 24 '16 at 16:16
  • @JGMiller Page Not found – Anwar Aug 24 '16 at 16:42
0

What you are looking for is oh my zsh. You can customize everything.

enter image description here

Check out more screen shots: Wiki page (screen shots).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.