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:

86234

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-06-24
ant-ivy - 2.5.3
Ebuild name:

dev-java/ant-ivy-2.5.3

Description

Ivy is a free java based dependency manager

Added to portage

2026-06-24

assertj-core - 3.27.7
Ebuild name:

dev-java/assertj-core-3.27.7

Description

Rich and fluent assertions for testing for Java

Added to portage

2026-06-24

awscli - 1.45.35
Ebuild name:

app-admin/awscli-1.45.35

Description

Universal Command Line Environment for AWS

Added to portage

2026-06-24

bcmail - 1.84
Ebuild name:

dev-java/bcmail-1.84

Description

The Bouncy Castle Java S/MIME APIs for handling S/MIME protocols

Added to portage

2026-06-24

bcpg - 1.84
Ebuild name:

dev-java/bcpg-1.84

Description

Java cryptography APIs

Added to portage

2026-06-24

bcpkix - 1.84
Ebuild name:

dev-java/bcpkix-1.84

Description

Java APIs for CMS, PKCS, EAC, TSP, CMP, CRMF, OCSP, and certificate generation

Added to portage

2026-06-24

bcprov - 1.84
Ebuild name:

dev-java/bcprov-1.84

Description

Java cryptography APIs

Added to portage

2026-06-24

bcutil - 1.84
Ebuild name:

dev-java/bcutil-1.84

Description

Java APIs for ASN.1 extension and utility APIs used to support bcpkix and bctl

Added to portage

2026-06-24

bear - 4.1.4
Ebuild name:

dev-util/bear-4.1.4

Description

A tool that generates a compilation database for clang tooling

Added to portage

2026-06-24

blake3 - 1.0.9
Ebuild name:

dev-python/blake3-1.0.9

Description

Python bindings for the BLAKE3 cryptographic hash function

Added to portage

2026-06-24

boto3 - 1.43.35
Ebuild name:

dev-python/boto3-1.43.35

Description

The AWS SDK for Python

Added to portage

2026-06-24

botocore - 1.43.35
Ebuild name:

dev-python/botocore-1.43.35

Description

Low-level, data-driven core of boto 3

Added to portage

2026-06-24

coverage - 7.14.3
Ebuild name:

dev-python/coverage-7.14.3

Description

Code coverage measurement for Python

Added to portage

2026-06-24

cutechess - 1.5.1
Ebuild name:

games-board/cutechess-1.5.1

Description

Cross-platform tools for working with chess engines

Added to portage

2026-06-24

deepmerge - 2.1.0
Ebuild name:

dev-python/deepmerge-2.1.0

Description

Tools to handle merging of nested data structures in python

Added to portage

2026-06-24

desktop-file-utils - 0.28-r1
Ebuild name:

dev-util/desktop-file-utils-0.28-r1

Description

Command line utilities to work with desktop menu entries

Added to portage

2026-06-24

duckdb - 1.5.4
Ebuild name:

dev-db/duckdb-1.5.4

Description

high-performance analytical database system

Added to portage

2026-06-24

fgl - 5.8.3.1
Ebuild name:

dev-haskell/fgl-5.8.3.1

Description

Martin Erwig's Functional Graph Library

Added to portage

2026-06-24

gentoo-dtd - 20260615
Ebuild name:

app-text/gentoo-dtd-20260615

Description

Document Type Definition for Gentoo-related XML files

Added to portage

2026-06-24

gnome-commander - 2.0.3
Ebuild name:

gnome-extra/gnome-commander-2.0.3

Description

A graphical, full featured, twin-panel file manager

Added to portage

2026-06-24

gnu-regexp - 1.1.4-r5
Ebuild name:

dev-java/gnu-regexp-1.1.4-r5

Description

GNU regular expression package for Java

Added to portage

2026-06-24

hspec-contrib - 0.5.2
Ebuild name:

dev-haskell/hspec-contrib-0.5.2

Description

Contributed functionality for Hspec

Added to portage

2026-06-24

jackcess - 4.0.10
Ebuild name:

dev-java/jackcess-4.0.10

Description

A pure Java library for reading from and writing to MS Access databases

Added to portage

2026-06-24

just - 1.52.0
Ebuild name:

dev-build/just-1.52.0

Description

Just a command runner (with syntax inspired by 'make')

Added to portage

2026-06-24

log4j-12-api - 2.26.0
Ebuild name:

dev-java/log4j-12-api-2.26.0

Description

The Apache Log4j 1.x Compatibility API

Added to portage

2026-06-24

log4j-api - 2.26.0
Ebuild name:

dev-java/log4j-api-2.26.0

Description

The Apache Log4j API

Added to portage

2026-06-24

log4j-core - 2.26.0
Ebuild name:

dev-java/log4j-core-2.26.0

Description

The Apache Log4j Implementation

Added to portage

2026-06-24

mistune - 3.3.2
Ebuild name:

dev-python/mistune-3.3.2

Description

The fastest markdown parser in pure Python

Added to portage

2026-06-24

perl - 5.44.0_rc1
Ebuild name:

dev-lang/perl-5.44.0_rc1

Description

Larry Wall's Practical Extraction and Report Language

Added to portage

2026-06-24

phonenumbers - 9.0.33
Ebuild name:

dev-python/phonenumbers-9.0.33

Description

Python port of Google's libphonenumber

Added to portage

2026-06-24

poi - 5.5.1
Ebuild name:

dev-java/poi-5.5.1

Description

Java API to access Mocrosoft format files

Added to portage

2026-06-24

prettytable - 3.18.0
Ebuild name:

dev-python/prettytable-3.18.0

Description

Easily displaying tabular data in a visually appealing ASCII table fo

Added to portage

2026-06-24

pyfuse3 - 3.5.0
Ebuild name:

dev-python/pyfuse3-3.5.0

Description

Python 3 bindings for libfuse 3 with asynchronous API

Added to portage

2026-06-24

pypdf - 6.14.0
Ebuild name:

dev-python/pypdf-6.14.0

Description

Python library to work with PDF files

Added to portage

2026-06-24

python - 0.3.15.0_beta3
Ebuild name:

dev-lang/python-0.3.15.0_beta3

Description

Freethreading (no-GIL) version of Python programming language

Added to portage

2026-06-24

python - 3.15.0_beta3
Ebuild name:

dev-lang/python-3.15.0_beta3

Description

An interpreted, interactive, object-oriented programming language

Added to portage

2026-06-24

python-tests - 0.3.15.0_beta3
Ebuild name:

dev-python/python-tests-0.3.15.0_beta3

Description

Test modules from dev-lang/python

Added to portage

2026-06-24

python-tests - 3.15.0_beta3
Ebuild name:

dev-python/python-tests-3.15.0_beta3

Description

Test modules from dev-lang/python

Added to portage

2026-06-24

sccache - 0.16.0
Ebuild name:

dev-util/sccache-0.16.0

Description

ccache/distcc like tool with support for rust and cloud storage

Added to portage

2026-06-24

setuptools-scm - 10.1.1
Ebuild name:

dev-python/setuptools-scm-10.1.1

Description

Manage versions by scm tags via setuptools

Added to portage

2026-06-24

setuptools-scm - 10.1.2
Ebuild name:

dev-python/setuptools-scm-10.1.2

Description

Manage versions by scm tags via setuptools

Added to portage

2026-06-24

shellcheck - 0.11.0
Ebuild name:

dev-util/shellcheck-0.11.0

Description

Shell script analysis tool

Added to portage

2026-06-24

shelltestrunner - 1.11
Ebuild name:

dev-util/shelltestrunner-1.11

Description

Easy, repeatable testing of CLI programs/commands

Added to portage

2026-06-24

sqlmap - 1.10.6
Ebuild name:

dev-db/sqlmap-1.10.6

Description

An automatic SQL injection and database takeover tool

Added to portage

2026-06-24

trang - 20241231-r1
Ebuild name:

app-text/trang-20241231-r1

Description

Multi-format schema converter based on RELAX NG

Added to portage

2026-06-24

translate-toolkit - 3.19.12
Ebuild name:

dev-python/translate-toolkit-3.19.12

Description

Toolkit to convert between many translation formats

Added to portage

2026-06-24

unison-lang-bin - 1.3.0-r1
Ebuild name:

dev-lang/unison-lang-bin-1.3.0-r1

Description

A friendly programming language from the future

Added to portage

2026-06-24

vcs-versioning - 2.1.0
Ebuild name:

dev-python/vcs-versioning-2.1.0

Description

Core VCS versioning functionality from setuptools-scm

Added to portage

2026-06-24

yara-x - 1.18.0
Ebuild name:

app-forensics/yara-x-1.18.0

Description

A malware identification and classification tool

Added to portage

2026-06-24

zeroconf - 0.150.0
Ebuild name:

dev-python/zeroconf-0.150.0

Description

Pure Python Multicast DNS Service Discovery Library (Bonjour/Avahi comp

Added to portage

2026-06-24

2026-06-23
courier - 2.0.1
Ebuild name:

mail-mta/courier-2.0.1

Description

An MTA designed specifically for maildirs

Added to portage

2026-06-23

courier-authlib - 0.73.0
Ebuild name:

net-libs/courier-authlib-0.73.0

Description

Courier authentication library

Added to portage

2026-06-23

courier-unicode - 2.6.0
Ebuild name:

net-libs/courier-unicode-2.6.0

Description

Unicode library used by the courier mail server

Added to portage

2026-06-23

pkgcheck - 0.10.39-r1
Ebuild name:

dev-util/pkgcheck-0.10.39-r1

Description

pkgcore-based QA utility for ebuild repos

Added to portage

2026-06-23

rspamd - 4.0.1-r1
Ebuild name:

mail-filter/rspamd-4.0.1-r1

Description

Rapid spam filtering system

Added to portage

2026-06-23

rspamd - 4.1.1
Ebuild name:

mail-filter/rspamd-4.1.1

Description

Rapid spam filtering system

Added to portage

2026-06-23

spyder-kernels - 3.1.4_p20260622
Ebuild name:

dev-python/spyder-kernels-3.1.4_p20260622

Description

Kernels used by spyder on its ipython console

Added to portage

2026-06-23

zdkimfilter - 3.24
Ebuild name:

mail-filter/zdkimfilter-3.24

Description

DKIM filter for Courier-MTA

Added to portage

2026-06-23

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