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:

84944

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-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-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

zim - 0.76.3-r1
Ebuild name:

x11-misc/zim-0.76.3-r1

Description

A desktop wiki

Added to portage

2026-05-04

2026-05-03
alsa-tools - 1.2.15-r3
Ebuild name:

media-sound/alsa-tools-1.2.15-r3

Description

Advanced Linux Sound Architecture tools

Added to portage

2026-05-03

arj - 3.10.22_p28-r1
Ebuild name:

app-arch/arj-3.10.22_p28-r1

Description

Utility for opening arj archives

Added to portage

2026-05-03

bear - 4.1.2
Ebuild name:

dev-util/bear-4.1.2

Description

A tool that generates a compilation database for clang tooling

Added to portage

2026-05-03

blender-bin - 4.2.20
Ebuild name:

media-gfx/blender-bin-4.2.20

Description

3D Creation/Animation/Publishing System

Added to portage

2026-05-03

blender-bin - 4.5.9
Ebuild name:

media-gfx/blender-bin-4.5.9

Description

3D Creation/Animation/Publishing System

Added to portage

2026-05-03

blender-bin - 5.1.1
Ebuild name:

media-gfx/blender-bin-5.1.1

Description

3D Creation/Animation/Publishing System

Added to portage

2026-05-03

boost-m4 - 0.4_p20250404
Ebuild name:

dev-build/boost-m4-0.4_p20250404

Description

Another set of autoconf macros for compiling against boost

Added to portage

2026-05-03

capnproto - 1.4.0
Ebuild name:

dev-libs/capnproto-1.4.0

Description

RPC/Serialization system with capabilities support

Added to portage

2026-05-03

cargo-c - 0.10.22
Ebuild name:

dev-util/cargo-c-0.10.22

Description

Helper program to build and install c-like libraries

Added to portage

2026-05-03

chrony - 4.8-r1
Ebuild name:

net-misc/chrony-4.8-r1

Description

NTP client and server programs

Added to portage

2026-05-03

closure-compiler-bin - 20260429
Ebuild name:

dev-lang/closure-compiler-bin-20260429

Description

JavaScript optimizing compiler

Added to portage

2026-05-03

clr-loader - 0.3.1
Ebuild name:

dev-python/clr-loader-0.3.1

Description

Generic pure Python loader for .NET runtimes

Added to portage

2026-05-03

cudd - 3.0.0-r1
Ebuild name:

sci-mathematics/cudd-3.0.0-r1

Description

Colorado University binary Decision Diagram library

Added to portage

2026-05-03

dar - 2.8.5
Ebuild name:

app-backup/dar-2.8.5

Description

A full featured backup tool, aimed for disks

Added to portage

2026-05-03

dropbear - 2026.90
Ebuild name:

net-misc/dropbear-2026.90

Description

Small SSH 2 client/server designed for small memory environments

Added to portage

2026-05-03

easycrypt - 2026.05
Ebuild name:

sci-mathematics/easycrypt-2026.05

Description

Computer-Aided Cryptographic Proofs

Added to portage

2026-05-03

evisum - 2.0.4
Ebuild name:

sys-process/evisum-2.0.4

Description

System and process monitor written with EFL

Added to portage

2026-05-03

gcc - 16.1.1_p20260502
Ebuild name:

sys-devel/gcc-16.1.1_p20260502

Description

The GNU Compiler Collection

Added to portage

2026-05-03

gnome-session-openrc - 49.1-r1
Ebuild name:

gnome-base/gnome-session-openrc-49.1-r1

Description

Gnome session leader for OpenRC

Added to portage

2026-05-03

gzip - 1.14_p20260502
Ebuild name:

app-arch/gzip-1.14_p20260502

Description

Standard GNU compressor

Added to portage

2026-05-03

ipy - 1.01-r2
Ebuild name:

dev-python/ipy-1.01-r2

Description

Class and tools for handling of IPv4 and IPv6 addresses and networks

Added to portage

2026-05-03

kotlin-bin - 2.3.21
Ebuild name:

dev-lang/kotlin-bin-2.3.21

Description

Statically typed language that targets the JVM and JavaScript

Added to portage

2026-05-03

libburn - 1.5.8-r1
Ebuild name:

dev-libs/libburn-1.5.8-r1

Description

Open-source library for reading, mastering and writing optical discs

Added to portage

2026-05-03

libisoburn - 1.5.8-r1
Ebuild name:

dev-libs/libisoburn-1.5.8-r1

Description

Creation/expansion of ISO-9660 filesystems on CD/DVD media supported b

Added to portage

2026-05-03

lxc - 7.0.0
Ebuild name:

app-containers/lxc-7.0.0

Description

A userspace interface for the Linux kernel containment features

Added to portage

2026-05-03

lxcfs - 7.0.0
Ebuild name:

sys-fs/lxcfs-7.0.0

Description

FUSE filesystem for LXC

Added to portage

2026-05-03

mac - 12.76
Ebuild name:

media-sound/mac-12.76

Description

Monkey's Audio Codecs

Added to portage

2026-05-03

mit-krb5 - 1.22.2-r1
Ebuild name:

app-crypt/mit-krb5-1.22.2-r1

Description

MIT Kerberos V

Added to portage

2026-05-03

moto - 5.2.0
Ebuild name:

dev-python/moto-5.2.0

Description

Mock library for boto

Added to portage

2026-05-03

mpv - 0.41.0-r2
Ebuild name:

media-video/mpv-0.41.0-r2

Description

Media player for the command line

Added to portage

2026-05-03

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-03

nagios-mode - 0.4
Ebuild name:

app-emacs/nagios-mode-0.4

Description

Major mode for editing Nagios configuration files

Added to portage

2026-05-03

navi2ch - 1.8.4-r2
Ebuild name:

app-emacs/navi2ch-1.8.4-r2

Description

A navigator for the Japanese textboard 2ch

Added to portage

2026-05-03

nerd-icons - 0.1.0
Ebuild name:

app-emacs/nerd-icons-0.1.0

Description

Emacs Nerd Font Icons Library

Added to portage

2026-05-03

nginx-mode - 1.1.10
Ebuild name:

app-emacs/nginx-mode-1.1.10

Description

Emacs editing mode for Nginx config files

Added to portage

2026-05-03

no-littering - 1.8.7
Ebuild name:

app-emacs/no-littering-1.8.7

Description

ELisp library that helps keeping Emacs configuration directory clean

Added to portage

2026-05-03

pango - 1.57.1
Ebuild name:

x11-libs/pango-1.57.1

Description

Internationalized text layout and rendering library

Added to portage

2026-05-03

papers - 49.6-r1
Ebuild name:

app-text/papers-49.6-r1

Description

A document viewer for the GNOME desktop

Added to portage

2026-05-03

pbr - 7.0.3-r1
Ebuild name:

dev-python/pbr-7.0.3-r1

Description

Inject some useful and sensible default behaviors into setuptools

Added to portage

2026-05-03

pbr - 7.0.3-r2
Ebuild name:

dev-python/pbr-7.0.3-r2

Description

Inject some useful and sensible default behaviors into setuptools

Added to portage

2026-05-03

portage - 3.0.78
Ebuild name:

sys-apps/portage-3.0.78

Description

The package management and distribution system for Gentoo

Added to portage

2026-05-03

postfix - 3.11.2
Ebuild name:

mail-mta/postfix-3.11.2

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-05-03

pytest-asyncio - 1.4.0_alpha2
Ebuild name:

dev-python/pytest-asyncio-1.4.0_alpha2

Description

Library for testing asyncio code with pytest

Added to portage

2026-05-03

pythonnet - 3.0.5-r1
Ebuild name:

dev-python/pythonnet-3.0.5-r1

Description

Nearly seamless integration with the .NET Common Language Runtime

Added to portage

2026-05-03

rclone - 1.74.0
Ebuild name:

net-misc/rclone-1.74.0

Description

A program to sync files to and from various cloud storage providers

Added to portage

2026-05-03

sabnzbd - 5.0.1
Ebuild name:

net-nntp/sabnzbd-5.0.1

Description

Binary newsgrabber with web-interface

Added to portage

2026-05-03

sccache - 0.15.0
Ebuild name:

dev-util/sccache-0.15.0

Description

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

Added to portage

2026-05-03

skim - 4.6.1
Ebuild name:

app-misc/skim-4.6.1

Description

Command-line fuzzy finder

Added to portage

2026-05-03

suricata - 7.0.15-r1
Ebuild name:

net-analyzer/suricata-7.0.15-r1

Description

High performance Network IDS, IPS and Network Security Monitoring e

Added to portage

2026-05-03

system-monitoring-center - 3.4.0
Ebuild name:

sys-apps/system-monitoring-center-3.4.0

Description

Multi-featured system monitor GUI written in Python

Added to portage

2026-05-03

tavern - 3.4.0
Ebuild name:

dev-python/tavern-3.4.0

Description

A tool, library, and Pytest plugin for testing RESTful APIs

Added to portage

2026-05-03

tea - 0.14.0
Ebuild name:

dev-util/tea-0.14.0

Description

Command line tool to interact with Gitea server

Added to portage

2026-05-03

tifffile - 2026.5.2
Ebuild name:

dev-python/tifffile-2026.5.2

Description

Read and write TIFF files

Added to portage

2026-05-03

tox - 4.53.1
Ebuild name:

dev-python/tox-4.53.1

Description

virtualenv-based automation of test activities

Added to portage

2026-05-03

transient - 0.13.2
Ebuild name:

app-emacs/transient-0.13.2

Description

Transient commands abstraction for GNU Emacs

Added to portage

2026-05-03

unbound - 1.25.0
Ebuild name:

net-dns/unbound-1.25.0

Description

A validating, recursive and caching DNS resolver

Added to portage

2026-05-03

wcwidth - 0.7.0
Ebuild name:

dev-python/wcwidth-0.7.0

Description

Measures number of Terminal column cells of wide-character codes

Added to portage

2026-05-03

whipper - 0.10.0-r4
Ebuild name:

media-sound/whipper-0.10.0-r4

Description

A Python CD-DA ripper preferring accuracy over speed (forked from mor

Added to portage

2026-05-03

xterm - 410
Ebuild name:

x11-terms/xterm-410

Description

Terminal Emulator for X Windows

Added to portage

2026-05-03

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