for example, if I do a
mkdir thisismyfolder912
I remember there is some easier way to switch to thisismyfolder912 than having to do a
cd thisismyfolder912
What is that way and how does it work? Also, what are the other ways I can use this?
|
for example, if I do a
I remember there is some easier way to switch to
What is that way and how does it work? Also, what are the other ways I can use this? |
||||
|
Are you talking about classic history expansion, or Readline processing? |
|||||||||||||
|
|
It's as simple as Alt + .
Alt + .
|
|||||||||||
|
|
If your question is about accessing command history, then try this well-named command
You can also try Ctrl + r, and start typing a command you're trying to remember that you've recently typed.
Hit ESC to select the command or exit. This works for me on SuSE at least; not sure about other distros. |
|||||||||
|
|
If you use bash i suggest
|
|||||
|
|
Picking up a tip from another thread, if you put:
in your .bashrc then, you can start typing something from your history, and then press the up arrow, and then rather than going through your history item by item, it'll skip right to previous entries that begin with what you've already typed. I guess this doesn't help much with the particular example given in the question, but it is one thing that helps me access history on the fly. |
|||
|
|
|
If your shell uses readline (which is the case for From the GNU Readline documentation:
|
||||
|
|
|
On a related note, I recommend using histverify in bash. Put this in your ~/.bashrc:
This will cause bash to print out the command after expanding !$ or other history functions, and give you a chance to look at it before hitting enter again to actually run it. For me, the sanity check is worth the occasional extra key press. Want to make sure I'm running the I frequently use the Ctrl-R approach, as well as Alt-. (which is a good fit for the scenario you describe). I'll use !$ on occasion. These are very useful general purpose techniques. But to address your specific question: Making a directory and cd'ing directly into it is such a common combination that it is useful to have a function to wrap it up..
Usage: |
|||
|
|
cd this<TAB>– invert Aug 26 '10 at 13:37