On Thu, Sep 3, 2009 at 6:54 AM, Bharathi
Subramanian<[email protected]> wrote:
>> Can you Tell how to create customized key bindings in linux
>> terminal. For example i have run a "ls -l" when pressing F1 Key in
>> terminal.
>
> Read man loadkeys
>

Thanks Bharathi. I read the manpages and had to spend time
searching the Internet till I got halfway. I could get F5 to
print a string.

But I wanted enter also to be pressed. Then I saw this page.

http://www.hermann-uwe.de/tips-and-tricks/showkey-loadkeys-tricks

It is not so obvious what to do. This page also helped me.

http://tldp.org/HOWTO/Keyboard-and-Console-HOWTO-15.html

This is what I did.

You cannot set a new keymap unless you are root. It is obvious
but not mentioned anywhere.

So this is what I did.

Login as root.

# dumpkeys > keys.map

# vim keys.map

In this case you want to search for a line like this,

string F1 = "\033[[A"

It occurs in line number 662 in my case. I am sure it is going to
be the same in yours too.

Set it to

string F1 = "\033[[ls -l\n"

Then load the new keymap.

# loadkeys keys.map

Then go to a different virtual console , login as yourself and
press 'F1'.

Voila. It now works!

But you have to be logged in of course. ;)

Obviously this done not work in xterms. I never got that to work.

That is a separate project involving a different set of programs I think.

-Girish
-- 
Gayatri Hitech
web: http://gayatri-hitech.com

SpamCheetah Spam filter:
http://spam-cheetah.com
_______________________________________________
To unsubscribe, email [email protected] with 
"unsubscribe <password> <address>"
in the subject or body of the message.  
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to