Search code examples
shellterminaliterm2iterm

(Linux terminal or iTerm) How do I block select to delete(or edit)


This is not that important function though, how do I block select (to edit) at the terminal? For example, when you have the following command and I want to erase the middle one (nano)

apt-get update && apt-get install nano && apt-get install emacs

How can I select that command instead of just presssing down the delete key?

In case of common text editors such like sublime or notepad, you can press shift + <- or drag with your mouse to do that. how can I do that in terminal?


Solution

  • personally, when I need to write a long command, I press ctrl-x ctrl-e to write it in my editor (my setting is vim).

    If you want to do some navigation on command line, for example the default emacs bind, you can:

    alt-b  #to go back a word
    alt-f  #to go after a word
    alt-d  #to del a word (after cursor)
    ctrl-w #to delete a word before cursor
    

    with some shell(e.g. zsh), you can even go to some certain character in the line, like vim's f/F