Binding a command to a keystroke - terminal sessions


OK, so I have moderate Linux experience on servers, but am finally using Gnome on a desktop daily and have one problem I would love to have solved.

I used to use Van Dyke's SecureCRT on my Windows laptop, and really just trying to replicate its behavior. I have a gnome-terminal icon setup to run an SSH script that prompts me for a host name, then logs me in. Not too tough. T opens another SSH session. Again, not too difficult.
What I can't figure out is, I want to bind a keystroke to a command, i.e. in any SSH gnome-terminal window I want to be able to hit J and have it output:
ps -ef | grep [j]ava | gawk -F ' ' ' { print $2,"\t",$NF} ' | sort -k 2
I've got hundreds of hosts that don't all have access to the same location to run the same set of commands, and I don't have the ability to customize root's/other users' rc files to setup aliases.

I was hoping I could use the Gnome's keyboard shortcuts to dump the output of a file on my local system to the gnome-terminal window, but that doesn't seem to work. Am I perhaps overlooking something SSH could do for me? Or is there some other hack somebody else has figured out?

One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix