Announcement

Collapse
No announcement yet.

Using Konsole

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Using Konsole

    If I use the konsole and type a command, I get output.

    If I type further commands, I receive output.

    If I type 'clear', it clears the existing screen, but not the previous sessions

    How can I clear the whole screen?

    Thanks
    kubuntu version: 16.04.5 LTS

    Laptop: Toshiba-Satellite-L350

    #2
    Wow you opened a can of worms with that one

    See
    Code:
    man clear
    and then try to figure out how to set E3 for your xterm. I have not personally looked into it, maybe it is easy.

    Sorry not the most helpful but it may get you started.

    Comment


      #3
      By previous sessions, do you mean the bash history - the commands entered previously that you can scroll through with the up/down arrow keys?

      If so: http://www.commandlinefu.com/command...n-history-bash
      Note that each terminal used, including login terminals, don't automatically write the cached history back to file immediately, so this would have to be done for every terminal in use.

      Comment


        #4
        I am trying to completely clear the terminal screen
        kubuntu version: 16.04.5 LTS

        Laptop: Toshiba-Satellite-L350

        Comment


          #5
          Ok, ctrl-shift-k will do it
          for typing/scripting, google seems to indicate that clear && printf '\e[3J' will do this, probably creating a bash alias for this would be easier to remember, lol!

          Comment


            #6
            Yes, it does work.

            Is there a logic to this sequence?

            Best wishes.

            A
            kubuntu version: 16.04.5 LTS

            Laptop: Toshiba-Satellite-L350

            Comment


              #7
              Is there a logic to what sequence? Could you rephrase the question?

              Comment


                #8
                Originally posted by anonprivate View Post
                Yes, it does work.

                Is there a logic to this sequence?

                Best wishes.

                A
                There is, but I cannot find the link that explains it

                The clear part is fairly obvious, but the printf '\e[3J' is not.
                If I am remembering it correctly, the printf part is a direct terminal command, and remember Konsole, xterm, etc are all terminal emulators. There is some sort of formatting/translation problem with using printf '\e3J', which is the (old unix??) terminal command to clear the scrollback. The ']' fixes this.

                Or something along those lines. I am guessing most people use the keyboard combos to do the job nowdays?

                Comment


                  #9
                  Originally posted by claydoh View Post
                  There is, but I cannot find the link that explains it

                  The clear part is fairly obvious, but the printf '\e[3J' is not.
                  If I am remembering it correctly, the printf part is a direct terminal command, and remember Konsole, xterm, etc are all terminal emulators. There is some sort of formatting/translation problem with using printf '\e3J', which is the (old unix??) terminal command to clear the scrollback. The ']' fixes this.

                  Or something along those lines. I am guessing most people use the keyboard combos to do the job nowdays?
                  Thank you.

                  Regarding ctrl-shift-k, I assume that this works simply because terminal is programmed to accept this sequence for clearance purposes.

                  Best wishes.

                  A
                  kubuntu version: 16.04.5 LTS

                  Laptop: Toshiba-Satellite-L350

                  Comment


                    #10
                    Originally posted by anonprivate View Post
                    Is there a logic to this sequence?
                    Well... printf is a bash built-in command, that has the useful property of interpreting "character escape sequences" in its first argument; echo -e does the same a bit more obviously. The argument has to be in single quotes or bash will do something else with the \, before handing it to the command; echo -e \\e[3J will work as well.

                    \e is expanded to the ESC character, ASCII 27, and ESC followed by [ together form the 7-bit version of a "CSI", "command sequence introducer" IIRC. "J" is the command to Erase in Display, and the 3 is an argument that means erase the saved lines; originally 0 erased below the cursor, 1 before, and 2 the whole screen, I guess someone picked 3 as the next available number. See Xterm Control Sequences for the all the details. xterm was the first terminal emulator for the X windowing system and most terminal emulators like konsole follow what xterm does, varying how perfectly they do. xterm, in turn, emulates a DEC VT100 from the seventies, but the escape sequences were originally an ANSI standard; I doubt there was any particular reason J was the erase display command.
                    Last edited by jlittle; Oct 17, 2014, 12:25 AM. Reason: typo
                    Regards, John Little

                    Comment


                      #11
                      Back in the days of using terminals (which, unfortunately I am old enough to remember), the escape codes just like these were used to control the cursor positioning and scrolling on VT100 terminals. The vt100 was so pervasive that the escape codes became like a defacto standard. Konsole, gnome-terminal, and xterm all respond to these VT100 codes. If you want to have some fun, you can also change the color of text in your window with the vt100-color escape codes:

                      $ echo -e '\e[32mhello, world\e[0m'

                      prints "hello, world" in green text before changing the text color back to the default.

                      Comment


                        #12
                        Originally posted by andystmartin View Post
                        Back in the days of using terminals (which, unfortunately I am old enough to remember)
                        Hey! There's nothing UNFORTUNATE about being that old. I feel like I've come home again when I see those old escape codes that I used to know inside out, back when my work environment consisted of a UNIX server and a bunch of Wyse 60 and 150 terminals I connected to it.
                        Xenix/UNIX user since 1985 | Linux user since 1991 | Was registered Linux user #163544

                        Comment


                          #13
                          Originally posted by DoYouKubuntu View Post
                          Hey! There's nothing UNFORTUNATE about being that old.
                          Opinions vary on that...
                          I feel like I've come home again when I see those old escape codes that I used to know inside out, back when my work environment consisted of a UNIX server and a bunch of Wyse 60 and 150 terminals I connected to it.
                          I've written termcap entries, when the suppliers' ones were no good. Like RS 232 and break out boxes, stuff no-one should've needed to know even back then.


                          Regards, John Little
                          Regards, John Little

                          Comment


                            #14
                            Originally posted by DoYouKubuntu View Post
                            Hey! There's nothing UNFORTUNATE about being that old. I feel like I've come home again when I see those old escape codes that I used to know inside out, back when my work environment consisted of a UNIX server and a bunch of Wyse 60 and 150 terminals I connected to it.
                            You? Commodore Grace? A connection?
                            Are you she, or did you and her just go out for coffee together and discuss that bug she found in a relay between the vacuum tubes while trying to determine why the computer program stopped running?

                            I'll wager you have a clear memory of the old green P4 screens and, perhaps, the Hollerith punch cards and the KSR-133 keyboards and the punched tape they created!
                            "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                            – John F. Kennedy, February 26, 1962.

                            Comment


                              #15
                              Originally posted by GreyGeek View Post
                              You? Commodore Grace? A connection?
                              Are you she, or did you and her just go out for coffee together and discuss that bug she found in a relay between the vacuum tubes while trying to determine why the computer program stopped running?

                              I'll wager you have a clear memory of the old green P4 screens and, perhaps, the Hollerith punch cards and the KSR-133 keyboards and the punched tape they created!
                              Oh, shoot, my cover is blown! Now everyone knows how old I REALLY am! It's true, Rear Admiral Grace and I were buddies...with birthdays ONE day apart, no less.
                              Xenix/UNIX user since 1985 | Linux user since 1991 | Was registered Linux user #163544

                              Comment

                              Working...
                              X