Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Two keystroke 'ls -F' shortcut UNIX
A very silly hint, but one I haven't seen anywhere else and which might prove useful to someone...

In a terminal window, hit ESC twice to perform an ls -F. Saves typing a few characters.

[Editor's note: Wow, it works! Is this a bug or a feature??]
  • Currently 5.00 / 5
  You rated: 5 / 5 (3 votes cast)

Two keystroke 'ls -F' shortcut | 10 comments | Create New Account
Click here to return to the 'Two keystroke 'ls -F' shortcut' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Only works for csh/tcsh
Authored by: SpherCow on Feb 26, '02 03:23:24AM

This tip only works in csh and tcsh. It doesn't work in bash (my default), zsh, or sh. So this is probably more of a csh bug|feature than something related to the Terminal application.

[ Reply to This | # ]
One keystroke less...
Authored by: Franco on Feb 26, '02 04:36:14AM

You get the same list hitting <tab> just once...

[ Reply to This | # ]
Use alias to make your own shortcuts
Authored by: Anonymous on Feb 26, '02 05:35:59AM

Spend some time to set up your alias and working in the Terminal will be much more pleasent. I use Bash and here are some of the alias I have put in my .bashrc.

alias .='pwd'
alias ..='cd ..'
alias cd..='cd ..'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias l='ls -laF'
alias ll='ls -laF | less'
alias c='clear'

[ Reply to This | # ]
Authored by: dperetti on Feb 26, '02 06:24:33AM

Any sufficiently advanced bug is indistinguishable from a feature.

[ Reply to This | # ]
It's a feature!
Authored by: owain_vaughan on Feb 26, '02 07:04:40AM

All you're doing is filename completion in the current directory without having entered an intial part of the filename. Useful - certainly. Bug - never!!

[ Reply to This | # ]
I get this...
Authored by: rusto on Feb 26, '02 07:42:53AM
In bash shell I get this response:

Display all 978 possibilities? (y or n)

responding "y" returns a plain old vanilla "ls" plus what looks like every possible command doable in the Terminal, all output in two columns.

[ Reply to This | # ]
Authored by: thinkyhead on Feb 26, '02 08:22:21PM
No, double-escape is not the same as the "ls -F" command.

The shells csh / tcsh let you bind key combinations to built-in shell commands. The double-escape sequence is bound to "complete-word" by default. This is a context-sensitive command. On a blank line you'll get something like the output of "ls -F" and if you type the following:

chmod esc-esc

You'll get a list of modes you can use: a g o u

Type "bindkey" by itself to see the complete list of bound keys. Read the tcsh man-pages for more information about commands that can be bound to keys.

[ Reply to This | # ]
Another one in csh/tcsh
Authored by: zal on Feb 26, '02 10:36:49PM
Maybe everybody knows, but... I'll tell anyway:
Hit CONTROL-X and then CONTROL-D and you'll see the listing of all commands possible in (Darwin || csh/tcsh || any shell ?)

[ Reply to This | # ]
Repeat yourself
Authored by: thinkyhead on Feb 27, '02 03:32:29PM

Try this one:


Escape followed by a number causes the next non-numeric character to repeat that number of times.


[ Reply to This | # ]
esc + backspc
Authored by: Bishop on Feb 27, '02 07:20:49PM

True, it is not the same as typing ls -F, but rather autocompletions without any "start". Something else that might be useful is if you type esc, then backspc you delete the whole line. Ofcource you could type Ctrl-C instead to get a new line, but someone might like this.

[ Reply to This | # ]