2

I need to clear terminal fully, so the full terminal become darkfull.

What I mean by "fully", I need to username@machine$: not to pop up so terminal after clear would be completely empty. Just like cmatrix does before drawing digital rain.

5
  • You want to username@machine$: never show on screen ? Can you clarify your question a little ? Jan 19, 2019 at 9:22
  • @SergiyKolodyazhnyy not never but the first time. You can look at cmatrix package, i need the same realization as they clear screen before drawing digital rain. Jan 19, 2019 at 9:23
  • and have you tried the reset command ? cmatrix, however, uses ncurses library, so it doesn't just clear the screen. It opens completely different text interface. Jan 19, 2019 at 9:25
  • @sudodus actually no, because I'll have to use that space. Jan 19, 2019 at 9:33
  • @SergiyKolodyazhnyy Yes I did, but it still shows me username@machine$: Jan 19, 2019 at 9:33

1 Answer 1

2

The command prompt format is stored in the PS1 environment variable. If you set it to the empty string, no command prompt will be displayed. You can then clear the console:

user@host:$ PS1=
clear

If you need to restore it afterwards, you can save the initial value in a different variable first:

user@host:$ PS1_INITIAL=$PS1 # store the initial value
user@host:$ PS1=
PS1=$PS1_INITIAL # restore the initial value
user@host:$

Or you can source .bashrc where the original values are defined:

. ~/.bashrc
user@host:$
6
  • That looks pretty much like an answer, but how can i exit that mode? Jan 19, 2019 at 9:37
  • Allright, I've understood, if i want to exit that mode i have to save command prompt in another variable and restore it. Thanks. Jan 19, 2019 at 9:43
  • Close the terminal. PS1= will only set the environment variable in that specific terminal. Or set it back to the default value which you can see by running echo $PS1 in a different terminal (one that shows the default prompt).
    – danzel
    Jan 19, 2019 at 9:43
  • @V.Dalechin It's not a mode. PS1 prompt is the text shown before the cursor. You never entered a mode. After a command clear is issued you still can type in commands, but PS1 is set to empty empty string. All you have to do is set PS1 to something again. Jan 19, 2019 at 9:43
  • @SergiyKolodyazhnyy Thanks for clearing that up! Jan 19, 2019 at 9:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .