Tuesday, January 25, 2011

*nix shell with IOS style completion?

Is there a Linux shell that will let you type less than full commands as you can with Cisco IOS, at least for the first command (and not its arguments)?

I haven't really thought enough if this is actually a good thing, but might be fun to play with :-)

  • Almost all UNIX shells do tab completion by default. If you want shorter equivalent commands just create an alias for the ones you use commonly.

    The problem with tab completion is that there are so many commands in UNIX that you tend to need to type in many more characters than you would in IOS before the command prefix becomes unambiguous.

    FWIW, on my tcsh setup, typing tel<tab> offers me telinit, telltc and telnet. Only once I type n does it them autocomplete to the latter of those.

    Furthermore, some shells can then offer you command line arguments too, so long as it has been told in advance which arguments are valid for the current program.

    grawity : `bash` can do the same completion too, including command line arguments (for most popular commands). In most Linux distributions, you can get that by installing `bash-completion`.
    From Alnitak
  • No, I do not know of such as shell. However, you can get close to what you probably want with tab-completion (type in part of a command and hit the <Tab> key, and the shell will try to complete the command from what you gave it.

    Also, you can define command aliases using the shell builtin alias, like so:

    alias ll='ls -l'
    

    Which will replace the command ll with ls -l whenever you type it afterwards.

    From Silas
  • bash also allows tab autocompletion for arbitrary data sets (called Programmable Bash Completion), most usefully for SSH hostnames. Grab /etc/bash_completion from http://www.caliban.org/bash/index.shtml#completion and source it at login.

    From Troy Davis

0 comments:

Post a Comment