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:

83621

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 (26 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-03-09
clamav - 0.103.12-r4
Ebuild name:

app-antivirus/clamav-0.103.12-r4

Description

Clam Anti-Virus Scanner

Added to portage

2026-03-09

clamav - 1.4.4
Ebuild name:

app-antivirus/clamav-1.4.4

Description

Clam Anti-Virus Scanner

Added to portage

2026-03-09

clamav - 1.5.2
Ebuild name:

app-antivirus/clamav-1.5.2

Description

Clam Anti-Virus Scanner

Added to portage

2026-03-09

cloudflare-warp - 2026.1.150.0-r1
Ebuild name:

net-vpn/cloudflare-warp-2026.1.150.0-r1

Description

Cloudflare Warp Client

Added to portage

2026-03-09

fvwm3 - 1.1.4
Ebuild name:

x11-wm/fvwm3-1.1.4

Description

A multiple large virtual desktop window manager derived from fvwm

Added to portage

2026-03-09

gallery-dl - 1.31.9
Ebuild name:

net-misc/gallery-dl-1.31.9

Description

Download image galleries and collections from several image hosting site

Added to portage

2026-03-09

gcc - 16.0.1_p20260308
Ebuild name:

sys-devel/gcc-16.0.1_p20260308

Description

The GNU Compiler Collection

Added to portage

2026-03-09

groonga - 16.0.0-r1
Ebuild name:

app-text/groonga-16.0.0-r1

Description

An Embeddable Fulltext Search Engine

Added to portage

2026-03-09

joplin-desktop - 3.6.4
Ebuild name:

app-office/joplin-desktop-3.6.4

Description

Secure note taking and to-do app with synchronization capabilities

Added to portage

2026-03-09

modus-themes - 5.1.0
Ebuild name:

app-emacs/modus-themes-5.1.0

Description

Highly accessible themes for GNU Emacs

Added to portage

2026-03-09

modus-themes - 5.2.0
Ebuild name:

app-emacs/modus-themes-5.2.0

Description

Highly accessible themes for GNU Emacs

Added to portage

2026-03-09

modus-themes - 9999
Ebuild name:

app-emacs/modus-themes-9999

Description

Highly accessible themes for GNU Emacs

Added to portage

2026-03-09

octave - 11.1.0
Ebuild name:

sci-mathematics/octave-11.1.0

Description

High-level interactive language for numerical computations

Added to portage

2026-03-09

sdl3-image - 3.4.0
Ebuild name:

media-libs/sdl3-image-3.4.0

Description

A simple library to load images of various formats as SDL surfaces.

Added to portage

2026-03-09

2026-03-08
bibutils - 7.2
Ebuild name:

app-text/bibutils-7.2

Description

Interconverts between various bibliography formats using common XML intermedi

Added to portage

2026-03-08

django-polymorphic - 4.11.2
Ebuild name:

dev-python/django-polymorphic-4.11.2

Description

Seamless Polymorphic Inheritance for Django Models

Added to portage

2026-03-08

doxygen - 1.16.1
Ebuild name:

app-text/doxygen-1.16.1

Description

Documentation system for most programming languages

Added to portage

2026-03-08

e2fsprogs - 1.47.4
Ebuild name:

sys-fs/e2fsprogs-1.47.4

Description

Standard EXT2/EXT3/EXT4 filesystem utilities

Added to portage

2026-03-08

fpylll - 0.6.4-r1
Ebuild name:

dev-python/fpylll-0.6.4-r1

Description

Python bindings for sci-libs/fplll

Added to portage

2026-03-08

gcc - 15.2.1_p20260307
Ebuild name:

sys-devel/gcc-15.2.1_p20260307

Description

The GNU Compiler Collection

Added to portage

2026-03-08

gnome-shell-extension-weather-oclock - 50.0
Ebuild name:

gnome-extra/gnome-shell-extension-weather-oclock-50.0

Description

Display the current weather inside the pill n

Added to portage

2026-03-08

jaraco-context - 6.1.1
Ebuild name:

dev-python/jaraco-context-6.1.1

Description

Context managers by jaraco

Added to portage

2026-03-08

kokkos - 5.0.2
Ebuild name:

dev-cpp/kokkos-5.0.2

Description

C++ Performance Portability Programming EcoSystem

Added to portage

2026-03-08

kup - 0.3.6-r5
Ebuild name:

dev-util/kup-0.3.6-r5

Description

kernel.org uploader tool

Added to portage

2026-03-08

libtmux - 0.55.0
Ebuild name:

dev-python/libtmux-0.55.0

Description

Typed library that provides an ORM wrapper for tmux, a terminal multiplex

Added to portage

2026-03-08

libvirt - 12.1.0-r1
Ebuild name:

app-emulation/libvirt-12.1.0-r1

Description

C toolkit to manipulate virtual machines

Added to portage

2026-03-08

lutris - 0.5.19-r1
Ebuild name:

games-util/lutris-0.5.19-r1

Description

An open source gaming platform for GNU/Linux

Added to portage

2026-03-08

lutris - 0.5.20-r1
Ebuild name:

games-util/lutris-0.5.20-r1

Description

An open source gaming platform for GNU/Linux

Added to portage

2026-03-08

lutris - 0.5.22-r1
Ebuild name:

games-util/lutris-0.5.22-r1

Description

An open source gaming platform for GNU/Linux

Added to portage

2026-03-08

mac-fdisk - 0.1_p18-r2
Ebuild name:

sys-fs/mac-fdisk-0.1_p18-r2

Description

Mac/PowerMac disk partitioning utility

Added to portage

2026-03-08

mercurial - 7.2-r1
Ebuild name:

dev-vcs/mercurial-7.2-r1

Description

Scalable distributed SCM

Added to portage

2026-03-08

mgorny-dev-scripts - 67
Ebuild name:

app-portage/mgorny-dev-scripts-67

Description

Handy scripts for ebuild development and more

Added to portage

2026-03-08

mimalloc - 2.2.7
Ebuild name:

dev-libs/mimalloc-2.2.7

Description

A compact general purpose allocator with excellent performance

Added to portage

2026-03-08

mimalloc - 3.2.8
Ebuild name:

dev-libs/mimalloc-3.2.8

Description

A compact general purpose allocator with excellent performance

Added to portage

2026-03-08

mold - 2.40.4-r2
Ebuild name:

sys-devel/mold-2.40.4-r2

Description

A Modern Linker

Added to portage

2026-03-08

onlyoffice-bin - 9.3.1
Ebuild name:

app-office/onlyoffice-bin-9.3.1

Description

A free and open source office and productivity suite (binary versio

Added to portage

2026-03-08

petsc - 3.24.5
Ebuild name:

sci-mathematics/petsc-3.24.5

Description

Portable, Extensible Toolkit for Scientific Computation

Added to portage

2026-03-08

plasma-meta - 6.6.0-r1
Ebuild name:

kde-plasma/plasma-meta-6.6.0-r1

Description

Merge this to pull in all Plasma 6 packages

Added to portage

2026-03-08

plasma-meta - 6.6.2-r1
Ebuild name:

kde-plasma/plasma-meta-6.6.2-r1

Description

Merge this to pull in all Plasma 6 packages

Added to portage

2026-03-08

pyspellchecker - 0.9.0
Ebuild name:

dev-python/pyspellchecker-0.9.0

Description

Pure python spell checker based on work by Peter Norvig

Added to portage

2026-03-08

ristretto - 0.14.0
Ebuild name:

media-gfx/ristretto-0.14.0

Description

A fast and lightweight picture viewer for Xfce

Added to portage

2026-03-08

slepc - 3.24.2
Ebuild name:

sci-mathematics/slepc-3.24.2

Description

Scalable Library for Eigenvalue Problem Computations

Added to portage

2026-03-08

trilinos - 17.0.0
Ebuild name:

sci-libs/trilinos-17.0.0

Description

Scientific library collection for large scale problems

Added to portage

2026-03-08

upmpdcli - 1.9.14
Ebuild name:

media-sound/upmpdcli-1.9.14

Description

UPnP Media Renderer front-end for MPD, the Music Player Daemon

Added to portage

2026-03-08

wine-staging - 11.4
Ebuild name:

app-emulation/wine-staging-11.4

Description

Free implementation of Windows(tm) on Unix, with Wine-Staging patch

Added to portage

2026-03-08

wsjtx_improved - 3.1.0
Ebuild name:

media-radio/wsjtx_improved-3.1.0

Description

Weak signal ham radio communication with improvements

Added to portage

2026-03-08

xfce4-terminal - 1.2.0
Ebuild name:

x11-terms/xfce4-terminal-1.2.0

Description

A terminal emulator for the Xfce desktop environment

Added to portage

2026-03-08

xpadneo - 0.10
Ebuild name:

games-util/xpadneo-0.10

Description

Advanced Linux Driver for Xbox One Wireless Controller

Added to portage

2026-03-08

zmac - 1.3-r2
Ebuild name:

dev-embedded/zmac-1.3-r2

Description

Z80 macro cross-assembler

Added to portage

2026-03-08

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