VarjuOrg

Linux / Windows – what’s the difference…

VI commands on Linux

Here are some useful commands for “vi” that I’m used to use:

  1. Search and replace command that takes on the following structure:
    :%s/search_string/replacement_string/g
    (This command replaces every search_string on the current line with replacement_string and will continue to the end of file. However if you want to confirm first what you replace then you would want to replace “g” in the end of command with “c”)
  2. For deletion:
    :.,/Hello/d
    (Deletes from the current line to the next line that contained Hello.)
    :.,$d
    (Deletes from current lline to the end of the file)

, , , ,

Leave a Reply

Your email address will not be published.