Monday, January 26, 2009

Shelltips

Bash is so intuitive that you can just make shit up as you go and it still works.
Some of these autocommands I use, and some I just found out about screwing around 'researching'.


Automatic Command Completion

Use the TAB key and bash will attempt to complete the command for you automatically. You can use it to complete command (tool) names. You can also use it when working with the file−system, when changing directories, copying files et cetera.

There are also other lesser known ways to use automatic command completion (for example completing user names)

ESC−Y (Y: special character) Will attempt to complete the command name for you. If it fails it will either list the possible completions (if they exist). If there are none it will simply beep (and/or) flash the screen.

CTRL−X−Y (Y: special character) Lists the possible completions (it won't attempt to complete it for you) or beep if there are no possible completions.

Special−characters:

Use the following special characters combined with either ESC−Y or CTRL−X−Y , where Y is some special characters.

For example ESC−$ or CTRL−X−$ to complete an environment variable name.

◊ ~ (tilde) complete a user name
◊ @ (at sign) complete a machine name
◊ $ (dollars sign) complete an environment variable name
◊ ! (exclamation mark) a magic character for completing a
command name or a file name. The ! special character has the
same function as the TAB key. It works in some other
situations; for example when completing man page names.

No comments:

Post a Comment