You are not logged in.

#1 2008-09-09 14:56:39

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Alias a blank command to clear the screen

I just got a crazy idea. How can I alias an empty command (just hitting enter) to clear the screen in bash ?

Is it too crazy ?:lol:

Last edited by moljac024 (2008-09-09 14:56:57)


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#2 2008-09-09 15:01:05

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: Alias a blank command to clear the screen

Take a look at the sources for the readline library, there's probably a routine in there that handles empty commands. I don't think its a great idea though because if you pacman -Syu (for example) and accidentally press enter twice you will lose all the log out put after it runs.

BTW: the command to clear the screen is 'clear'

Dusty

Offline

#3 2008-09-09 15:18:15

kazuo
Member
From: São Paulo/Brazil
Registered: 2008-03-18
Posts: 413
Website

Re: Alias a blank command to clear the screen

You can use CTRL-L to clear the screen. I think, imho, this is the fastest method...

Offline

#4 2008-09-09 16:21:24

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: Alias a blank command to clear the screen

Dusty wrote:

Take a look at the sources for the readline library, there's probably a routine in there that handles empty commands. I don't think its a great idea though because if you pacman -Syu (for example) and accidentally press enter twice you will lose all the log out put after it runs.

BTW: the command to clear the screen is 'clear'

Dusty

You do have a point there.

BTW: Of course I know the command to clear the screen goddamn it! smile


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#5 2008-09-09 17:11:51

jordz
Member
Registered: 2006-02-01
Posts: 248

Re: Alias a blank command to clear the screen

kazuo wrote:

You can use CTRL-L to clear the screen. I think, imho, this is the fastest method...

Thank you I didn't know that!

Offline

#6 2008-09-09 22:30:25

pyther
Member
Registered: 2008-01-21
Posts: 1,395
Website

Re: Alias a blank command to clear the screen

And ctrl + U clears the current line!


Website - Blog - arch-home
Arch User since March 2005

Offline

#7 2008-09-10 00:20:43

dav7
Member
From: Australia
Registered: 2008-02-08
Posts: 674

Re: Alias a blank command to clear the screen

CTRL+U actually cuts. CTRL+Y pastes. Yay for having 3 clipboards in Linux: the one in X (select to copy, middle click to paste), the one shared with GNOME/KDE (standard shortcuts to copy/paste), and the one in the terminal emulator, which I just mentioned.

And I like to keep a space character in all of them, so they don't madly go pasting into IRC. At least the terminal one is per-terminal, not shared with the other clipboards, and deleted when you close the terminal it belongs to. roll

-dav7

Last edited by dav7 (2008-09-10 00:20:55)


Windows was made for looking at success from a distance through a wall of oversimplicity. Linux removes the wall, so you can just walk up to success and make it your own.
--
Reinventing the wheel is fun. You get to redefine pi.

Offline

Board footer

Powered by FluxBB