PuTTY and vi editor commands

putty PuTTY, a free telnet/ssh client is not that user friendly with black and ugly terminal screen. Developed in 1999, I can guess the reason why it is like that!


Use the left mouse button to select text in the PuTTY window, and this automatically copies the selected text to the clipboard. There is no need to press any keys or right-click on a selected area.


To paste the contents of the clipboard into the PuTTY window, simply right-click the mouse button. You can also paste by pressing the Shift+Ins (or Shift+Insert on some keyboards) keys together.

Some useful commands are:

ls – to list files in a directory:

cd – change directory (navigate to some directory):

cp – copy a file

mv – move a file (also used to rename files):

rm – remove a file

mkdir – make directory

pwd – show your current location

whoami – find out which user you are

q – quit or exit an application


vi editor commands in PuTTY.

Cursor Movement:
h = move the cursor to the left
j = move the cursor down 1 line
k = move the cursor up 1 line
l = move the cursor right (on some keyboards, the arrow keys have the same effect)
0 = move to the front of the line
$ = move to the end of the line
w = move forward one word
b = move backward one word
e = move forward to the end of the word
^F = move forward a screen full
^B = move backward a screen full
^D = move forward half a screen full
^U = move backward half a screen full
$ = move to the end of the line
G = move to the last line in the file
#G = move to line numbered #. (Ex: 5G. Ex: Use 0G to move to the top of the file.)
n = repeat last search
N = reverse direction of last search
/pat = move cursor to next occurrence of pattern ‘pat’ (forward search)
?pat = move cursor to previous occurrence of pattern pat backward search)
:1,$s/pattern/newpattern/g = replace all occurrences of pattern with new pattern.
i = insert before (new text will appear before the current cursor position) — leaves you in insert mode
a = append (new text appears after current cursor position) –leaves you in insert mode
o = open a new line below the current line
O = open a new line above the current line
rx = replace character under cursor with character x
cw = change current word Ex: cwnew = change current word to new
x = delete the character under the cursor
^H = erase last character (usually same as backspace)
dSPACE = delete the character beneath the cursor (SPACE == space bar)
dw = delete the rest of the current word
d$ = delete from cursor through end of current line
dd = delete the current line
#dd = delete # lines putting the lines into a save buffer
(Ex: 3dd deletes the current line and the two lines after.)
You can paste the lines back with P
Saving & Loading:
ZZ = write the data to the current file and then exit vi
:wq = same as ZZ
:w = write the file to the current file name (see also ^G, below)
:q = just quit vi. Will not work if any changes have been made
:q! = quit vi, discarding all changes. Use with caution!
:w name = save the contents to a file named ‘name’.
:r name = read file ‘name’ – insert it at this position.
u = undo the last change
. = repeat the last change
^V = used to specify a control character
(Ex: in insert mode, to insert a ^H type: ^V^H)
^L = redisplay the screen (useful if it gets messed up with too
many control characters)
^G = show the name of the current file and the line number of the current line
% = find matching ( or ) or { or }
#yy = ‘yank’ # lines, starting with the current line (like ‘copy’ in Windows)
p = ‘put’ those lines just yanked after the current line (like ‘paste’ in Windows)


Incoming search terms:

  • putty commands
  • vi putty
  • VI is not functioning in putty
  • vi editor in putty
  • vi double code for putty

Leave a Reply

Your email address will not be published. Required fields are marked *