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:

84964

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-05-05
chez - 10.4.0
Ebuild name:

dev-scheme/chez-10.4.0

Description

A programming language based on R6RS

Added to portage

2026-05-05

framework_tool - 0.6.2
Ebuild name:

app-laptop/framework_tool-0.6.2

Description

Tool to control Framework Computer systems

Added to portage

2026-05-05

gallery-dl - 1.32.1
Ebuild name:

net-misc/gallery-dl-1.32.1

Description

Download image galleries and collections from several image hosting site

Added to portage

2026-05-05

golangci-lint - 2.12.1
Ebuild name:

dev-go/golangci-lint-2.12.1

Description

Fast linters runner for Go

Added to portage

2026-05-05

iproute2 - 7.0.0
Ebuild name:

sys-apps/iproute2-7.0.0

Description

kernel routing and traffic control utilities

Added to portage

2026-05-05

keepassxc - 2.8.0_pre20260504
Ebuild name:

app-admin/keepassxc-2.8.0_pre20260504

Description

KeePassXC - KeePass Cross-platform Community Edition

Added to portage

2026-05-05

kubectl - 1.36.0
Ebuild name:

sys-cluster/kubectl-1.36.0

Description

CLI to run commands against Kubernetes clusters

Added to portage

2026-05-05

mako - 1.11.0
Ebuild name:

gui-apps/mako-1.11.0

Description

A lightweight notification daemon for Wayland. Works on Sway

Added to portage

2026-05-05

multi-term - 1.4-r1
Ebuild name:

app-emacs/multi-term-1.4-r1

Description

Manage multiple terminal buffers in Emacs

Added to portage

2026-05-05

multiple-cursors - 1.5.0
Ebuild name:

app-emacs/multiple-cursors-1.5.0

Description

Multiple cursors for Emacs

Added to portage

2026-05-05

muse - 3.20.2
Ebuild name:

app-emacs/muse-3.20.2

Description

An authoring and publishing environment for Emacs

Added to portage

2026-05-05

nprolog - 5.18
Ebuild name:

dev-lang/nprolog-5.18

Description

Interpreter and compiler to be compatible with Arity/Prolog32

Added to portage

2026-05-05

swaybg - 1.2.2
Ebuild name:

gui-apps/swaybg-1.2.2

Description

A wallpaper utility for Wayland

Added to portage

2026-05-05

swaylock - 1.8.5
Ebuild name:

gui-apps/swaylock-1.8.5

Description

Screen locker for Wayland

Added to portage

2026-05-05

upterm - 0.23.0
Ebuild name:

app-misc/upterm-0.23.0

Description

Instant Terminal Sharing

Added to portage

2026-05-05

voacapl - 0.7.7
Ebuild name:

sci-electronics/voacapl-0.7.7

Description

HF propagation prediction tool

Added to portage

2026-05-05

with-editor - 3.5.0
Ebuild name:

app-emacs/with-editor-3.5.0

Description

Use the Emacsclient as the of child processes

Added to portage

2026-05-05

wl-clipboard - 2.3.0
Ebuild name:

gui-apps/wl-clipboard-2.3.0

Description

Wayland clipboard utilities

Added to portage

2026-05-05

2026-05-04
backports-zstd - 1.4.0
Ebuild name:

dev-python/backports-zstd-1.4.0

Description

Backport of PEP-784 adding Zstandard to the standard library

Added to portage

2026-05-04

cachetools - 7.1.1
Ebuild name:

dev-python/cachetools-7.1.1

Description

Extensible memoizing collections and decorators

Added to portage

2026-05-04

citus - 12.1.12
Ebuild name:

dev-db/citus-12.1.12

Description

Open-source postgresql extension for clustering/multi-node setups

Added to portage

2026-05-04

citus - 13.2.2
Ebuild name:

dev-db/citus-13.2.2

Description

Open-source postgresql extension for clustering/multi-node setups

Added to portage

2026-05-04

citus - 14.0.1
Ebuild name:

dev-db/citus-14.0.1

Description

Open-source postgresql extension for clustering/multi-node setups

Added to portage

2026-05-04

cudd - 3.0.0-r2
Ebuild name:

sci-mathematics/cudd-3.0.0-r2

Description

Colorado University binary Decision Diagram library

Added to portage

2026-05-04

ffmpeg - 8.1.1
Ebuild name:

media-video/ffmpeg-8.1.1

Description

Complete solution to record/convert/stream audio and video

Added to portage

2026-05-04

gcc - 17.0.0_p20260503
Ebuild name:

sys-devel/gcc-17.0.0_p20260503

Description

The GNU Compiler Collection

Added to portage

2026-05-04

git-sources - 7.1_rc2
Ebuild name:

sys-kernel/git-sources-7.1_rc2

Description

The very latest -git version of the Linux kernel

Added to portage

2026-05-04

haproxy - 2.8.22
Ebuild name:

net-proxy/haproxy-2.8.22

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2026-05-04

haproxy - 3.0.21
Ebuild name:

net-proxy/haproxy-3.0.21

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2026-05-04

haproxy - 3.2.17
Ebuild name:

net-proxy/haproxy-3.2.17

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2026-05-04

haproxy - 3.3.8
Ebuild name:

net-proxy/haproxy-3.3.8

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2026-05-04

kodi - 22.0_alpha3
Ebuild name:

media-tv/kodi-22.0_alpha3

Description

A free and open source media-player and entertainment hub

Added to portage

2026-05-04

lgi - 0.9.2_p20260407
Ebuild name:

dev-lua/lgi-0.9.2_p20260407

Description

Lua bindings using gobject-introspection

Added to portage

2026-05-04

lua-utf8 - 0.2.0
Ebuild name:

dev-lua/lua-utf8-0.2.0

Description

A UTF-8 support module for Lua and LuaJIT

Added to portage

2026-05-04

micropolis - 1.0_p20250710
Ebuild name:

games-simulation/micropolis-1.0_p20250710

Description

Free version of the well-known city building simulation

Added to portage

2026-05-04

mistune - 3.2.1
Ebuild name:

dev-python/mistune-3.2.1

Description

The fastest markdown parser in pure Python

Added to portage

2026-05-04

neomutt - 20260504
Ebuild name:

mail-client/neomutt-20260504

Description

A small but very powerful text-based mail client

Added to portage

2026-05-04

nextcloud - 32.0.9
Ebuild name:

www-apps/nextcloud-32.0.9

Description

Personal cloud that runs on your own server

Added to portage

2026-05-04

nextcloud - 33.0.3
Ebuild name:

www-apps/nextcloud-33.0.3

Description

Personal cloud that runs on your own server

Added to portage

2026-05-04

openpgp-keys-emersion - 20260503
Ebuild name:

sec-keys/openpgp-keys-emersion-20260503

Description

OpenPGP key used by Simon Ser

Added to portage

2026-05-04

openpgp-keys-janwassenberg - 20260503
Ebuild name:

sec-keys/openpgp-keys-janwassenberg-20260503

Description

OpenPGP key used by Jan Wassenberg

Added to portage

2026-05-04

openpgp-keys-roymarples - 20260418-r1
Ebuild name:

sec-keys/openpgp-keys-roymarples-20260418-r1

Description

OpenPGP key used by Roy Marples

Added to portage

2026-05-04

piwigo - 16.4.0
Ebuild name:

www-apps/piwigo-16.4.0

Description

a photo gallery software for the web

Added to portage

2026-05-04

poetry-core - 2.4.0
Ebuild name:

dev-python/poetry-core-2.4.0

Description

Poetry PEP 517 Build Backend

Added to portage

2026-05-04

poezio - 0.17
Ebuild name:

net-im/poezio-0.17

Description

Console XMPP client that looks like most famous IRC clients

Added to portage

2026-05-04

prowlarr-bin - 2.3.7.5365
Ebuild name:

www-apps/prowlarr-bin-2.3.7.5365

Description

An indexer manager/proxy to integrate with your various PVR apps

Added to portage

2026-05-04

pyside - 6.11.0
Ebuild name:

dev-python/pyside-6.11.0

Description

Python bindings for the Qt framework

Added to portage

2026-05-04

pytz - 2026.2
Ebuild name:

dev-python/pytz-2026.2

Description

World timezone definitions for Python

Added to portage

2026-05-04

sbcl - 2.6.4
Ebuild name:

dev-lisp/sbcl-2.6.4

Description

Steel Bank Common Lisp (SBCL) is an implementation of ANSI Common Lisp

Added to portage

2026-05-04

sonarr-bin - 4.0.17.2967
Ebuild name:

www-apps/sonarr-bin-4.0.17.2967

Description

Sonarr is a Smart PVR for newsgroup and bittorrent users

Added to portage

2026-05-04

timescaledb - 2.26.4
Ebuild name:

dev-db/timescaledb-2.26.4

Description

Open-source time-series SQL database

Added to portage

2026-05-04

totem - 43.2-r1
Ebuild name:

media-video/totem-43.2-r1

Description

Media player for GNOME

Added to portage

2026-05-04

valgrind - 3.27.0_p1
Ebuild name:

dev-debug/valgrind-3.27.0_p1

Description

An open-source memory debugger for GNU/Linux

Added to portage

2026-05-04

wtforms - 3.2.2
Ebuild name:

dev-python/wtforms-3.2.2

Description

Flexible forms validation and rendering library for python web development

Added to portage

2026-05-04

wxmaxima - 26.05.0-r1
Ebuild name:

sci-mathematics/wxmaxima-26.05.0-r1

Description

Graphical frontend to Maxima, using the wxWidgets toolkit

Added to portage

2026-05-04

zim - 0.76.3-r1
Ebuild name:

x11-misc/zim-0.76.3-r1

Description

A desktop wiki

Added to portage

2026-05-04

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