homepage Welcome to WebmasterWorld Guest from 54.237.38.30
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
How to get back to a clean command prompt?!?
Driving me crazy...
AnonyMouse

10+ Year Member



 
Msg#: 4170598 posted 11:38 am on Jul 15, 2010 (gmt 0)

Hi,

I'm spending a lot of time on Unix boxes at the moment, and one productivity tip I really would like to know is how to wipe out whatever I've typed into the command line, without having to sit holding down the backspace key....

I know it's possible, as an ex-colleague once showed me many moons ago. Searching the web brings up results relating to "clear", which is not what I want - I simply want to revert to a nice clean command prompt, with one keystroke!

Any tips?

 

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4170598 posted 12:21 pm on Jul 15, 2010 (gmt 0)

CTRL+l (letter "L") clears the terminal. PageDown may do what you want.

AnonyMouse

10+ Year Member



 
Msg#: 4170598 posted 12:49 pm on Jul 15, 2010 (gmt 0)

Thanks for the reply - but CTRL+L clears my window and takes the prompt up to the top of the window, however it still leaves my prompt as it was, i.e. not empty :-(

(Good tip though!)

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4170598 posted 12:57 pm on Jul 15, 2010 (gmt 0)

Did you try the PageDown key? It is all going to depend on the bash interpreter you are running and how it is configured. See the GNU bash manual [gnu.org] for one point of reference.

TypicalSurfer

5+ Year Member



 
Msg#: 4170598 posted 12:58 pm on Jul 15, 2010 (gmt 0)

CTRL+c

lammert

WebmasterWorld Senior Member lammert us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4170598 posted 1:03 pm on Jul 15, 2010 (gmt 0)

You can use the kill backward command, which is in your shell interpreter probably assigned to Ctrl-U. It deletes all characters from the current position of your cursor to the beginning of the line.

The Ctrl-k key does the opposite: clear all characters from the current cursor position to the end of the line.

AnonyMouse

10+ Year Member



 
Msg#: 4170598 posted 1:06 pm on Jul 15, 2010 (gmt 0)

This has been bugging me so much, I actually tracked down my ex-colleague, here's what he said:

Ctrl-U - deletes to the left
if you're in the middle, Ctrl-K deletes to the right
so I tend to do Ctrl-KU as a habit

Aah, geek productivity tips!

AnonyMouse

10+ Year Member



 
Msg#: 4170598 posted 1:13 pm on Jul 15, 2010 (gmt 0)

Sorry, kudos to lammert, I didn't see his reply before I posted mine. Thanks lammert :-)

httpwebwitch

WebmasterWorld Administrator httpwebwitch us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4170598 posted 4:46 am on Jul 25, 2010 (gmt 0)

I did not know this. What a useful little shortcut! I'm relatively new at command-line Linux; I need to study that GNU bash manual

wheel

WebmasterWorld Senior Member wheel us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4170598 posted 11:22 pm on Jul 26, 2010 (gmt 0)

CTRL-R then start typing lets you search your command history. So if you did a command like
mysqldump -u username -p database -a -B>databasebackup.txt

then want to do it again? CTRL-R then hit 'm' and there's the whole command.

graeme_p

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4170598 posted 11:09 pm on Jul 30, 2010 (gmt 0)

@wheel, most useful command line tip ever! Thanks.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved