clear_console: New helper program to clear the *console*, including the _scrollback buffer_. DESCRIPTION clear_console clears your console if this is possible. It looks in the environment for the terminal type and then in the terminfo database to figure out how to clear the screen. To clear the buffer, it then changes the foreground virtual terminal to another terminal and then back to the original terminal. src in debian_bash: http://packages.qa.debian.org/b/bash.html
Thanks for informations. I don't like debian all-in-one patch style. Is clear_console somewhere alone?
Created attachment 579914 [details] c code
Created attachment 579915 [details] man page
source: http://archive.ubuntu.com/ubuntu/pool/main/b/bash/bash_4.2-2ubuntu2.diff.gz or: http://ftp.de.debian.org/debian/pool/main/b/bash/bash_4.2-2.diff.gz $ gzip -cd bash_xxx.diff.gz | patch -p1 -f
Created attachment 579920 [details] bash_logout
I think util-linux is a much better place for clear_console.
I don't think changing bash logout is good idea. There is clear binary and it is in ncurses package, so ncurses seems to be the most suitable to contain clear_console for me. Let's see what is the opinion of ncurses maintainer.
Recent kernels support a command to clear the scrollbuffer directly, without need to switch to another console and back. You can do that by 'tput E3' in shell. I'm not sure this is worth creating a new binary just for that. Let's ask the upstream maintainer.
There was some discussion of clear_console before, see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=376841 I don't know why there was no followup, but that's a place to start.
Thomas, do you think it would be acceptable to include in ncurses a script which simply calls "tput E3; clear" or do you prefer a C implementation?
ping!
hmm - I replied via email 2012/10/15, but the reply didn't get here. What I said then: I'm not sure what's needed: it's a one-liner if E3 exists and a regular "clear" if not. My point then that was that for a one-liner, and relatively small use, I'm not sure why it's especially useful in ncurses (perhaps starting by a patch to the package in Fedora would be the best way to proceed).
Instead of adding a new program, I've modified the clear(1) program to clear also the scrollback buffer if the E3 capability is present. This is in ncurses-5.9-8.20130126.fc19.
ncurses-5.9-10.20130413.fc18 has been submitted as an update for Fedora 18. https://admin.fedoraproject.org/updates/ncurses-5.9-10.20130413.fc18
ncurses-5.9-10.20130413.fc17 has been submitted as an update for Fedora 17. https://admin.fedoraproject.org/updates/ncurses-5.9-10.20130413.fc17
ncurses-5.9-10.20130413.fc18 has been pushed to the Fedora 18 stable repository. If problems still persist, please make note of it in this bug report.
ncurses-5.9-10.20130413.fc17 has been pushed to the Fedora 17 stable repository. If problems still persist, please make note of it in this bug report.