from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites: www.linuxhowtos.org
toolsntoys.linuxhowtos.org



Last additions:
How to make X listen on port 6000

How to make X listen on port 6000

words:

34

views:

87964

userrating:

average rating: 1.2 (52 votes) (1=very good 6=terrible)


May, 25th 2007:
April, 26th 2007:
Apr, 10th. 2007:
Druckversion . pdf icon
You are here: Tutorials per portage category->app-editors->VI

2. Commands



Below you will find a cheat-sheet with vi commands. This cheat sheet will also come in handy in the next section of this document,
Practice Lesson #1.



vi cheat-sheet


a. cursor movements (items below are sometimes called objects):
h - left one character
l - right one character
j - down one line
k - up one line
w - right one word
b - back one word
$ - to the end of line
0 - to the beginning of the line
) - right one sentence
( - left one sentence
} - right one paragraph
{ - left one paragraph
Ctrl-F - forward one page
Ctrl-B - back one page
G - go to (without arguments, go to end of file)
b. deleting:
d - delete
then add one of the cursor movement symbols to
show what should be deleted, i.e.:
d$ - delete to end of line
d0 - delete to the beginning of the line
d} - delete to the end of paragraph
dd - delete delete (delete the whole line)
x - delete character cursor is on
c. other basic commands:
r - replace one character
ZZ - save and exit (hold down shift and press "z" twice)
y - yank (copy into temporary buffer)
then add cursor movement symbol to show what should be
copied, for example: y) - copy to the end of sentence
Y - yank line cursor is on
p - paste below cursor line (deleted or copied text)
P - paste above cursor line
u - undo last editing command
/sometext - search for "sometext"

d. any command can take numeric argument before the name of "object", i.e.:
5dd - delete 5 lines beginning with cursor line (or) d5d - same
2dw - delete two words (or) d2w - delete two words
c3w - change 3 words
3Ctrl-B - move up three pages
1G - go to the first line
e. external commands can be performed on the selected text (in lines)
if command is started with "!", i.e.:
!}fmt - reformat paragraph to 72 columns
f. command line (sometimes called "ex mode"):
:
g. from the command line a "set" command can be executed to
customize editing environment, i.e.:
:set all - will show the state of all options
:set number - will show on the screen numbers of all lines
:set autoindent // obvious
h. from the command line operations can be performed on the range of lines,
i.e.:
:18,24 del - delete from line 18 to line 24
:23,48 copy 17 - block from line 23 to 48 copy to line 17
:2,17 move 92 - block from line 2 to 17 move to line 92
i. from the command line any external UNIX command can be performed on
the range of lines if line range is superseded by "!":
:11,16! sed -e "s/^//*/" -e "s/$/*//"

(the command above wraps the block of text with
"C" style comments - /* text */. It can be done
easier, but this is an example)
:14,19! sort -r +3
(sort the table in reverse order by fourth column)
j. file manipulation from the command line:
:r somefile - read in "somefile"
:x - save and exit (if file is "Read Only", this command will
exit without saving)
:wq - write and quit (same as above)
:w - write (save) if the file permissions allow it
:w! - save file even if it is read-only as long as we own it
:w somefile - save this file as "somefile"
:q - quit without saving
:q! - quit without saving if changes were made
k. text input commands (all require "Esc" to terminate):
i - insert text before the character cursor is on
I - insert text at the beginning of the line
a - append (insert text after the character cursor is on)
A - append text to the end of the line
c - change (replace previous text with new one)
takes arguments just like the delete command - it is
a fast and powerful way of changing original text -
much more so than typical "overwrite"

R - start overwriting text
o - start entering text at the beginning of the new line
below the cursor
O - start entering text at the beginning of the new line
above the cursor
l. if in doubt, press "Esc"


/* The article above and any accompanying files are freely
* distributable, but please leave this notice and the text intact.
* Home for this document: http://www.infobound.com/vi.html
* Copyright (C) 1994, 1999 Tony Thomas
* Contact author through email:
tony@infobound.com
* Last revision Feb 23, 1999
* UNIX is a trademark of X/Open
*/

rate this article:
current rating: average rating: 1.2 (48 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

back



Support us on Content Nation

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2026-08-27
cargo-c - 0.10.25
Ebuild name:

dev-util/cargo-c-0.10.25

Description

Helper program to build and install c-like libraries

Added to portage

2026-08-27

paraview - 6.1.1
Ebuild name:

sci-visualization/paraview-6.1.1

Description

Powerful scientific data visualization application

Added to portage

2026-08-27

spotify - 1.2.96
Ebuild name:

media-sound/spotify-1.2.96

Description

Spotify is a social music platform

Added to portage

2026-08-27

systemd - 261.2
Ebuild name:

sys-apps/systemd-261.2

Description

System and service manager for Linux

Added to portage

2026-08-27

tor - 0.4.9.11-r1
Ebuild name:

net-vpn/tor-0.4.9.11-r1

Description

Anonymizing overlay network for TCP

Added to portage

2026-08-27

2026-08-26
acr38u - 1.7.11-r5
Ebuild name:

app-crypt/acr38u-1.7.11-r5

Description

Non CCID driver for ACR38 AC1038-based Smart Card Reader

Added to portage

2026-08-26

b4 - 0.16.0-r1
Ebuild name:

net-mail/b4-0.16.0-r1

Description

Utility for fetching patchsets from public-inbox

Added to portage

2026-08-26

boto3 - 1.43.80
Ebuild name:

dev-python/boto3-1.43.80

Description

The AWS SDK for Python

Added to portage

2026-08-26

botocore - 1.43.80
Ebuild name:

dev-python/botocore-1.43.80

Description

Low-level, data-driven core of boto 3

Added to portage

2026-08-26

cmd2 - 4.2.2
Ebuild name:

dev-python/cmd2-4.2.2

Description

Extra features for standard library's cmd module

Added to portage

2026-08-26

cramjam - 2.12.1
Ebuild name:

dev-python/cramjam-2.12.1

Description

Thin Python bindings to de/compression algorithms in Rust

Added to portage

2026-08-26

cryptography - 50.0.1
Ebuild name:

dev-python/cryptography-50.0.1

Description

Library providing cryptographic recipes and primitives

Added to portage

2026-08-26

firefox - 154.0.1
Ebuild name:

www-client/firefox-154.0.1

Description

Firefox Web Browser

Added to portage

2026-08-26

firefox-bin - 154.0.1
Ebuild name:

www-client/firefox-bin-154.0.1

Description

Firefox Web Browser

Added to portage

2026-08-26

firefox-l10n - 154.0.1
Ebuild name:

www-client/firefox-l10n-154.0.1

Description

Firefox Web Browser's translation files

Added to portage

2026-08-26

freerdp - 3.31.0
Ebuild name:

net-misc/freerdp-3.31.0

Description

Free implementation of the Remote Desktop Protocol

Added to portage

2026-08-26

gitpython - 3.1.60
Ebuild name:

dev-python/gitpython-3.1.60

Description

Library used to interact with Git repositories

Added to portage

2026-08-26

glibc - 2.43-r4
Ebuild name:

sys-libs/glibc-2.43-r4

Description

GNU libc C library

Added to portage

2026-08-26

glibc - 2.44-r2
Ebuild name:

sys-libs/glibc-2.44-r2

Description

GNU libc C library

Added to portage

2026-08-26

google-api-core - 2.35.0
Ebuild name:

dev-python/google-api-core-2.35.0

Description

Core Library for Google Client Libraries

Added to portage

2026-08-26

google-auth - 2.57.0
Ebuild name:

dev-python/google-auth-2.57.0

Description

Google Authentication Library

Added to portage

2026-08-26

google-auth-httplib2 - 0.4.2
Ebuild name:

dev-python/google-auth-httplib2-0.4.2

Description

httplib2 Transport for Google Auth

Added to portage

2026-08-26

google-auth-oauthlib - 1.4.1
Ebuild name:

dev-python/google-auth-oauthlib-1.4.1

Description

Google Authentication Library

Added to portage

2026-08-26

googleapis-common-protos - 1.75.2
Ebuild name:

dev-python/googleapis-common-protos-1.75.2

Description

Python classes generated from the common protos in the g

Added to portage

2026-08-26

gpxsee - 16.13
Ebuild name:

sci-geosciences/gpxsee-16.13

Description

Viewer and analyzer that supports gpx, tcx, kml, fit, igc and nmea fil

Added to portage

2026-08-26

gssapi - 1.12.0
Ebuild name:

dev-python/gssapi-1.12.0

Description

Low and high level wrappers around the GSSAPI C libraries

Added to portage

2026-08-26

jupyterlab-desktop-bin - 4.6.3.1
Ebuild name:

sci-misc/jupyterlab-desktop-bin-4.6.3.1

Description

JupyterLab desktop application, based on Electron

Added to portage

2026-08-26

libmd - 1.1.0
Ebuild name:

app-crypt/libmd-1.1.0

Description

Message Digest functions from BSD systems

Added to portage

2026-08-26

nbd - 3.27.1
Ebuild name:

sys-block/nbd-3.27.1

Description

Userland client/server for kernel network block device

Added to portage

2026-08-26

nsd - 4.15.1
Ebuild name:

net-dns/nsd-4.15.1

Description

An authoritative only, high performance, open source name server

Added to portage

2026-08-26

openrgb - 1.0_rc3_p1
Ebuild name:

app-misc/openrgb-1.0_rc3_p1

Description

Open source RGB lighting control

Added to portage

2026-08-26

pbr - 7.1.2
Ebuild name:

dev-python/pbr-7.1.2

Description

Inject some useful and sensible default behaviors into setuptools

Added to portage

2026-08-26

pbs-installer - 2026.8.25
Ebuild name:

dev-python/pbs-installer-2026.8.25

Description

Installer for Python Build Standalone

Added to portage

2026-08-26

plotly - 7.0.0
Ebuild name:

dev-python/plotly-7.0.0

Description

Browser-based graphing library for Python

Added to portage

2026-08-26

portalocker - 4.3.0
Ebuild name:

dev-python/portalocker-4.3.0

Description

A library for Python file locking

Added to portage

2026-08-26

proto-plus - 1.28.4
Ebuild name:

dev-python/proto-plus-1.28.4

Description

Beautiful, Pythonic protocol buffers

Added to portage

2026-08-26

pydata-sphinx-theme - 0.21.0
Ebuild name:

dev-python/pydata-sphinx-theme-0.21.0

Description

Bootstrap-based Sphinx theme from the PyData community

Added to portage

2026-08-26

tex4ht - 20240311_p72882-r5
Ebuild name:

dev-tex/tex4ht-20240311_p72882-r5

Description

Converts (La)TeX to (X)HTML, XML and OO.org

Added to portage

2026-08-26

thunderbird-bin - 140.14.1
Ebuild name:

mail-client/thunderbird-bin-140.14.1

Description

Thunderbird Mail Client

Added to portage

2026-08-26

tox - 4.60.1
Ebuild name:

dev-python/tox-4.60.1

Description

virtualenv-based automation of test activities

Added to portage

2026-08-26

urwid - 4.0.13
Ebuild name:

dev-python/urwid-4.0.13

Description

Curses-based user interface library for Python

Added to portage

2026-08-26

uv - 0.12.6
Ebuild name:

dev-python/uv-0.12.6

Description

A Python package installer and resolver, written in Rust

Added to portage

2026-08-26

uv-build - 0.12.6
Ebuild name:

dev-python/uv-build-0.12.6

Description

PEP517 uv build backend

Added to portage

2026-08-26

virtualenv - 21.7.5
Ebuild name:

dev-python/virtualenv-21.7.5

Description

Virtual Python Environment builder

Added to portage

2026-08-26

rdf newsfeed | rss newsfeed | Atom newsfeed
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
- Copyright and legal notices -
Time to create this page: 79.6 ms