Live data from Hacker News

Level Up Your Shell Game

viget.com

1–10 of 50 posts

Re: Level Up Your Shell Game

#2
I didn't see Ctrl-r, but I've found that to be the most insanely useful shortcut.

Ctrl-r = reverse history search. Type a partial command after Ctrl-r and it'll find the most recent executed command with that substring in it.

Press Ctrl-r again, jump to the next oldest command containing your substring. Did you accidentally press too many Ctrl-r? Press backspace to move forward in history.

Re: Level Up Your Shell Game

#3
post #2

I didn't see Ctrl-r, but I've found that to be the most insanely useful shortcut. Ctrl-r = reverse history search. Type a partial command after Ctrl-r and it'll find the most recent executed command with that substring in it. Press Ctrl-r again, jump to the next oldest command containing your substring. Did you accidentally press too many Ctrl-r? Press backspace to move forward in history.

Many of the solutions they highlight can actually be solved with this. Surprised that it wasn't included.

Re: Level Up Your Shell Game

#5
My favorite shell trick (not in the link) is this: ~-

Tilde-hyphen expands to the previous directory you were in, and of course "cd -" returns you to your previous directory, so I put them together all the time.

Here's an example workflow (with a fake PS1):

  mac:/Users/me/Projects/my_new_app$ cd ~/.pow

  mac:/Users/me/.pow$ ln -s ~- .

  mac:/Users/me/.pow$ cd -

  mac:/Users/me/Projects/my_new_app$
Now I can continue working on my app.

That's bit of a contrived example above. Here's a more realistic way to do a symlink for pow:

  mac:/Users/me/Projects/my_new_app$ ln -s `pwd` ~/.pow/

Re: Level Up Your Shell Game

#6
I like the commands, especially the ssh one, which I didn't know before and will certainly use in the future.

I also enjoyed the format of the article. A whole dev team each contributing their own piece to a blog post provides a lot of different voices and styles in a concise way.

Re: Level Up Your Shell Game

#7
The command line navigation commands are just what any Emacs user would expect. vi users can set their $EDITOR to 'vi' to get those commands.

What do you mean you've never used Emacs? mumble whippersnappers mumble

Re: Level Up Your Shell Game

#9

The command line navigation commands are just what any Emacs user would expect. vi users can set their $EDITOR to 'vi' to get those commands. What do you mean you've never used Emacs? mumble whippersnappers mumble

Use `set -o vi` to get vi navigation commands on the command line.

EDIT: In bash, that is. It's `bindkey -v` in zsh.

Re: Level Up Your Shell Game

#10
Here is a rule for how to level up your shell/editing game. If you ever touch your arrow keys, you are doing something wrong.

> ctrl + left arrow Moves the cursor to the left by one word > ctrl + right arrow Moves the cursor to the right by one word

Alt + b and Alt + f are also aliases for the same action.

Post reply on HN