1752746 Members
4786 Online
108789 Solutions
New Discussion юеВ

Esc characters on Linux

 
SOLVED
Go to solution
Stuart Abramson
Trusted Contributor

Esc characters on Linux

I'm used to using HP-UX wherein I can:

1. Type "history" and see my previous commands.
2. Type "ESC-k" and get back my last command.
3. Type ll xxx[ESC-ESC] and have the rest of the file name fill in for me.

Can somebody please tell me how to do those simple little things on Linux? We are using RedHat Linux on a Dell PowerEdge. I'm running the bash shell.
6 REPLIES 6
Bojan Nemec
Honored Contributor
Solution

Re: Esc characters on Linux

Stuart,

Yust type "history" for yours previous commands.
Type "up arrow" to get yours last command.
And type "TAB" to fill the file name. It works also for all commands and programs at the beginning of the line.

Bojan
Kodjo Agbenu
Honored Contributor

Re: Esc characters on Linux

Hi,

1. "history" does the same on my Linux box (SuSE).

2. "ESC-k" is very easy to configure : edit the .bashrc file in your home dir, and add :

UNSET INPUTRC
set -o vi

3. On linux I use TAB for filename completion. It has some nice features, like "TAB-TAB" that looks into the "PATH" and displays all executable files that match the first characters you typed.

Of course if you prefer another shell than bash, you can configure your Linux box to use it. As an example : pdksh is a clone of korn shell.

Good lcuk.

Kodjo
Learn and explain...
Ermin Borovac
Honored Contributor

Re: Esc characters on Linux

One more alternative for q3.

Place the following in your $HOME/.inputrc

"\e\e":complete-filename

ESC-ESC will now complete the filename.
Huc_1
Honored Contributor

Re: Esc characters on Linux

To know which shell is on your system do
#cat /etc/shells
On most Linux distribution you will have the following shell available

/bin/sh
/bin/bash
/sbin/nologin
/bin/ash
/bin/bsh
/bin/ksh
/usr/bin/ksh
/usr/bin/pdksh
/bin/tcsh
/bin/csh

To interactively change this use chsh command
for permanent change modify the /etc/passwd entry for the user

Also the default is usualy bash in emacs line mode, but if you like vi line mode better follow the set -o vi will do the trick.

Jean-Pierre Huc
Smile I will feel the difference
renarios
Trusted Contributor

Re: Esc characters on Linux

Hi Stuart,

If you use set -o vi, the auto-complete function changes in [ESC][\] in stead of [ESC ESC] which you are used to on HP-UX.
The first time for me with bash, I really missed vi-ing on the command line (i.e. ESC-k / )

Cheerio,

Renarios
Nothing is more successfull as failure
Stuart Abramson
Trusted Contributor

Re: Esc characters on Linux

Thanks all!