259
eeee
5y

Today I discovered by myself that...

...in a shell...

...when entering a password (e.g. ssh)...

...and you make a typo... 🤦‍♂️

...you don't need to smack that backspace key like a maniac! You can just use the clear line shortcut: control+U (^U). This clears all input to the left of your cursor and this also works for passwords.

Comments
  • 26
    🤯
  • 13
    I knew that, same as I know ctrl+s saves it from the first try, but I still like to rape the keys appereantly 😅
  • 35
    @M1sf3t I've been working with Linux/terminals for about 9 years now and I still discover 'very well known' things now and then!

    (Recently alt+.)
  • 14
    If you didn’t know, you might also find ctrl+w useful, for deleting the last “word”, rather than the whole line.
  • 2
  • 6
    I'm so happy since I discovered CTRL-r (search history), it saved me so much typing on frequent commands.
  • 8
    *takes notes, keep them coming*
  • 1
  • 4
    In zsh, you can type the begining of a command you need and use the arrow keys to search through history based on that start. Crazy useful.
  • 1
    I should really learn more shell shortcuts some day. I had no idea about Ctrl-U.
  • 0
  • 2
    Thank you! This helped me massively!
  • 3
    @ddephor Reverse search seems nice unless you realize that forward search (should be Ctrl + S) is often mapped to something else in certain distros, so it's annoying when navigating too far.

    Recently, I switched to fzr https://github.com/junegunn/fzf and it is a huge production boost.

    Here some issues with the forward search: https://unix.stackexchange.com/a/...
  • 0
    @k0pernikus fzf and fish are the best combo I would say
  • 0
  • 3
    I am sorry but Ctrl + u will never replace that satisfaction of smacking backspace.
  • 2
    @rusty-hacker Risky: in Windows it closes the current window.
  • 0
    @k0pernikus Backward search is ok for me. I usually search for commands I can use directly without any change, so I use the significant part as search term. Or I search for a somehow similar command and change just a part to save typing.
  • 0
    Nice tip!

    I have memorized 'Ctrl+a, Ctrl+k' and imagine it as machine gunning down everything on the prompt.
  • 4
    I find "Ctrl + p/n" useful, so you don't need to move your arm to the up/down arrow key.
  • 0
    For password fields in browser- I hit ctrl + back and it clears everything
  • 3
    Since a lot of people are now posting their favorite shortcuts:

    Keep in mind that bash and other shells use emacs binding as a default. So search for a list of emacs bindings and see if they work on your command line. (For example, Ctr + T would swap the last two letters, fixing typos like `gti` into `git`).

    Before any hardcore vi{,m} user has a heart attack not being able to bear the thought of having used emacs all along: You can safe yourself by switching to vi bindings on bash.
  • 0
  • 0
  • 0
    😱😱😱😱😱 it works!!
  • 0
    🔖
Add Comment