commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
It gives a 'xcd' command for changing directory to one of CWDs of other ZSH processes (typically running in a terminal emulator). Useful for single-windowed terminal emulators like XTerm or Rxvt which don't have ability to pass CWD of one shell to another.
Tested with bash v4.1.5 on ubuntu 10.10
as written above, only works for programs with no file extention (i.e 'proggy', but not 'proggy.sh')
because \eb maps to readine function backward-word rather then shell-backward-word (which
is unbinded by default on ubuntu), and correspondingly for \ef.
if you're willing to have Ctrl-f and Ctrl-g taken up too , you can insert the following lines
into ~/.inputrc, in which case invoking Ctrl-e will do the right thing both for "proggy" and "proggy.sh".
-- cut here --
-- cut here --
enable each bash completion that you have installed at your system, that's very nice ;)
When browsing java source code (for example) it's really annoying having to type the first letter of the package when there is only one package in the subdir.
man bash for more info about FIGNORE
In Bash, when defining an alias, one usually loses the completion related to the function used in that alias (that completion is usually defined in /etc/bash_completion using the complete builtin).
It's easy to reuse the work done for that completion in order to have smart completion for our alias.
That's what is done by this command line (that's only an example but it may be very easy to reuse).
Note 1 : You can use given command line in a loop "for old in apt-get apt-cache" if you want to define aliases like that for many commands.
Note 2 : You can put the output of the command directly in your .bashrc file (after the ". /etc/bash_completion") to always have the alias and its completion
Pressing ESC then * will insert in the command line the results of the autocompletion.
It's hard to explain but if you look the sample output or do
echo ESC *
you will understand quickly.
By the way, few reminders about ESC :
- Hold ESC does the same thing as tab tab
- 'ESC .' inserts the last argument of last command (can be done many times in order to get the last argument of all previous commands)
When you have to manage lot of servers, it's boring to type ssh root@myhost for each connection. Now you can type juste "s someting" and you are connected.
You can too add bash_completion script to complet with tab the name of your servers. This will be the next tips from me ;)