LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Puppy
User Name
Password
Puppy This forum is for the discussion of Puppy Linux.

Notices


Reply
  Search this Thread
Old 08-27-2015, 10:06 AM   #1
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Rep: Reputation: 169Reputation: 169
How to find character sequence (or keycodes)


I want to be able to assign a text string to a key combination.

Ctrl-v does not show the character sequence, it pops up the menu.

How can I see the character sequences?

Quote:
You can determine the character sequence emitted by a key by pressing Ctrl-v at the command line, then pressing the key you're interested in. On my system for F12, I get ^[[24~. The ^[ represents Esc. Different types of terminals or terminal emulators can emit different codes for the same key.

At a Bash prompt you can enter a command like this to enable the key macro so you can try it out.

bind '"\e[24~":"foobar"'

Now, when you press F12, you'll get "foobar" on the command line ready for further editing. If you wanted a keystroke to enter a command immediately, you can add a newline:

bind '"\e[24~":"pwd\n"'
 
Old 08-27-2015, 12:42 PM   #2
dewelker
LQ Newbie
 
Registered: Jul 2015
Location: Baltimore
Posts: 1

Rep: Reputation: Disabled
Reply to Thread: How to find character sequence (or keycodes)

More information is necessary regarding what environment you are using. The control-v technique as well as the bind commands work for me, but that is while using Putty to access a Linux system running RHEL 4 - 6 in a bash shell.
 
Old 08-27-2015, 01:26 PM   #3
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
What specific info about my environment do you need ?

I would think key scan codes would be the same no matter what distro is being used.
 
Old 08-27-2015, 09:05 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,324
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
If you are looking to see the output of keypress, you could try xev if X is running, though its output can be kind of overwhelming.

There's also showkey.
 
Old 08-28-2015, 09:50 AM   #5
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
I used xev, but can not figure out how to use bind with the scan codes I got.
 
Old 08-28-2015, 08:25 PM   #6
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,324
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
All I've ever used xev for was to identify a key so I could configure a keybinding in Fluxbox. I managed to do it, but xev's output is rather overwhelming. I'm afraid I've reached the linit of my experience with this one.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and Replace character/special character from the file MyRelam Red Hat 8 05-21-2012 12:52 AM
[SOLVED] How to find the character sequence for Ctrl-l jithin1987 Linux - General 3 08-08-2011 04:55 PM
Question about inserting a character into a 2dimensional sequence. RHLinuxGUY Programming 6 11-27-2005 10:52 PM
How do I map a key sequence to a specific character? QtCoder Linux - General 0 11-28-2003 12:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Puppy

All times are GMT -5. The time now is 05:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration