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:

82739

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-01-08
age - 1.3.1
Ebuild name:

app-crypt/age-1.3.1

Description

A simple, modern and secure encryption tool (and Go library)

Added to portage

2026-01-08

celestia - 1.7.0_pre20241231-r1
Ebuild name:

sci-astronomy/celestia-1.7.0_pre20241231-r1

Description

OpenGL 3D space simulator

Added to portage

2026-01-08

closure-compiler-bin - 20260104
Ebuild name:

dev-lang/closure-compiler-bin-20260104

Description

JavaScript optimizing compiler

Added to portage

2026-01-08

curtail - 1.14.0
Ebuild name:

media-gfx/curtail-1.14.0

Description

Image compressor, supporting PNG, JPEG and WebP

Added to portage

2026-01-08

fennel - 1.6.1
Ebuild name:

dev-lang/fennel-1.6.1

Description

Lisp-like language that compiles to Lua

Added to portage

2026-01-08

kirigami-addons - 1.11.0
Ebuild name:

dev-libs/kirigami-addons-1.11.0

Description

Visual end user components for Kirigami-based applications

Added to portage

2026-01-08

lfe - 2.2.0-r1
Ebuild name:

dev-lang/lfe-2.2.0-r1

Description

Lisp-flavoured Erlang, a lisp syntax front-end to the Erlang compiler

Added to portage

2026-01-08

limesuite - 23.11.0_p20250714
Ebuild name:

net-wireless/limesuite-23.11.0_p20250714

Description

Driver and GUI for LMS7002M-based SDR platforms

Added to portage

2026-01-08

picard - 3.0_pre20260107
Ebuild name:

media-sound/picard-3.0_pre20260107

Description

Cross-platform music tagger

Added to portage

2026-01-08

poppler - 26.01.0
Ebuild name:

app-text/poppler-26.01.0

Description

PDF rendering library based on the xpdf-3.0 code base

Added to portage

2026-01-08

sbctl - 0.18
Ebuild name:

app-crypt/sbctl-0.18

Description

Secure Boot key manager

Added to portage

2026-01-08

sbsigntools - 0.9.5
Ebuild name:

app-crypt/sbsigntools-0.9.5

Description

Utilities for signing and verifying files for UEFI Secure Boot

Added to portage

2026-01-08

2026-01-07
anyio - 4.12.1
Ebuild name:

dev-python/anyio-4.12.1

Description

Compatibility layer for multiple asynchronous event loop implementations

Added to portage

2026-01-07

avidemux - 2.8.1_p20251019-r1
Ebuild name:

media-video/avidemux-2.8.1_p20251019-r1

Description

Video editor designed for simple cutting, filtering and enc

Added to portage

2026-01-07

awscli - 1.44.13
Ebuild name:

app-admin/awscli-1.44.13

Description

Universal Command Line Environment for AWS

Added to portage

2026-01-07

boto3 - 1.42.23
Ebuild name:

dev-python/boto3-1.42.23

Description

The AWS SDK for Python

Added to portage

2026-01-07

botocore - 1.42.23
Ebuild name:

dev-python/botocore-1.42.23

Description

Low-level, data-driven core of boto 3

Added to portage

2026-01-07

claude-code - 2.0.77
Ebuild name:

dev-util/claude-code-2.0.77

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2026-01-07

conan - 2.24.0
Ebuild name:

dev-util/conan-2.24.0

Description

Distributed C/C++ package manager

Added to portage

2026-01-07

cryfs - 1.0.3
Ebuild name:

sys-fs/cryfs-1.0.3

Description

Encrypted FUSE filesystem that conceals metadata

Added to portage

2026-01-07

derper - 1.92.4
Ebuild name:

net-vpn/derper-1.92.4

Description

DERP server for tailscale network

Added to portage

2026-01-07

django - 5.2.10
Ebuild name:

dev-python/django-5.2.10

Description

High-level Python web framework

Added to portage

2026-01-07

django - 6.0.1
Ebuild name:

dev-python/django-6.0.1

Description

High-level Python web framework

Added to portage

2026-01-07

fish - 4.3.3
Ebuild name:

app-shells/fish-4.3.3

Description

Friendly Interactive SHell

Added to portage

2026-01-07

flog - 4.9.4
Ebuild name:

dev-ruby/flog-4.9.4

Description

Flog reports the most tortured code in an easy to read pain report

Added to portage

2026-01-07

genkernel - 4.3.17-r3
Ebuild name:

sys-kernel/genkernel-4.3.17-r3

Description

Gentoo automatic kernel building scripts

Added to portage

2026-01-07

google-auth - 2.47.0
Ebuild name:

dev-python/google-auth-2.47.0

Description

Google Authentication Library

Added to portage

2026-01-07

hackrf-tools - 2026.01.1
Ebuild name:

net-wireless/hackrf-tools-2026.01.1

Description

tools for communicating with HackRF SDR platform

Added to portage

2026-01-07

hcloud - 1.59.0
Ebuild name:

app-admin/hcloud-1.59.0

Description

A command-line interface for Hetzner Cloud

Added to portage

2026-01-07

hypothesis - 6.150.0
Ebuild name:

dev-python/hypothesis-6.150.0

Description

A library for property based testing

Added to portage

2026-01-07

icu - 78.1
Ebuild name:

dev-libs/icu-78.1

Description

International Components for Unicode

Added to portage

2026-01-07

jdk - 27
Ebuild name:

virtual/jdk-27

Description

Virtual for Java Development Kit (JDK)

Added to portage

2026-01-07

jre - 27
Ebuild name:

virtual/jre-27

Description

Virtual for Java Runtime Environment (JRE)

Added to portage

2026-01-07

kraft - 2.0.0
Ebuild name:

app-office/kraft-2.0.0

Description

Quotes and invoices manager for small enterprises

Added to portage

2026-01-07

kube-apiserver - 1.33.7
Ebuild name:

sys-cluster/kube-apiserver-1.33.7

Description

Kubernetes API server

Added to portage

2026-01-07

kube-controller-manager - 1.33.7
Ebuild name:

sys-cluster/kube-controller-manager-1.33.7

Description

Kubernetes Controller Manager

Added to portage

2026-01-07

kube-proxy - 1.33.7
Ebuild name:

sys-cluster/kube-proxy-1.33.7

Description

Kubernetes Proxy service

Added to portage

2026-01-07

kube-scheduler - 1.33.7
Ebuild name:

sys-cluster/kube-scheduler-1.33.7

Description

Kubernetes Scheduler

Added to portage

2026-01-07

kubeadm - 1.33.7
Ebuild name:

sys-cluster/kubeadm-1.33.7

Description

CLI to Easily bootstrap a secure Kubernetes cluster

Added to portage

2026-01-07

kubectl - 1.33.7
Ebuild name:

sys-cluster/kubectl-1.33.7

Description

CLI to run commands against Kubernetes clusters

Added to portage

2026-01-07

kubelet - 1.33.7
Ebuild name:

sys-cluster/kubelet-1.33.7

Description

Kubernetes Node Agent

Added to portage

2026-01-07

ldoc - 1.5.0
Ebuild name:

dev-lua/ldoc-1.5.0

Description

LuaDoc-compatible documentation generation system

Added to portage

2026-01-07

libhackrf - 2026.01.1
Ebuild name:

net-libs/libhackrf-2026.01.1

Description

library for communicating with HackRF SDR platform

Added to portage

2026-01-07

libofx - 0.10.9-r1
Ebuild name:

dev-libs/libofx-0.10.9-r1

Description

Library to support the Open Financial eXchange XML format

Added to portage

2026-01-07

libxdg-basedir - 1.2.3-r1
Ebuild name:

dev-libs/libxdg-basedir-1.2.3-r1

Description

Small library to access XDG Base Directories Specification paths

Added to portage

2026-01-07

lidarr-bin - 3.1.2.4902
Ebuild name:

www-apps/lidarr-bin-3.1.2.4902

Description

Looks and smells like Sonarr but made for music

Added to portage

2026-01-07

micawber - 0.6.2
Ebuild name:

dev-python/micawber-0.6.2

Description

A small library for extracting rich content from urls

Added to portage

2026-01-07

narwhals - 2.15.0
Ebuild name:

dev-python/narwhals-2.15.0

Description

Extremely lightweight compatibility layer between dataframe libraries

Added to portage

2026-01-07

openjdk - 27_alpha3
Ebuild name:

dev-java/openjdk-27_alpha3

Description

Open source implementation of the Java programming language

Added to portage

2026-01-07

openjdk-bin - 26_beta29
Ebuild name:

dev-java/openjdk-bin-26_beta29

Description

Prebuilt Java JDK binaries provided by Eclipse Temurin

Added to portage

2026-01-07

openjdk-bin - 27_alpha3
Ebuild name:

dev-java/openjdk-bin-27_alpha3

Description

Prebuilt Java JDK binaries provided by Eclipse Temurin

Added to portage

2026-01-07

pathspec - 1.0.1
Ebuild name:

dev-python/pathspec-1.0.1

Description

Utility library for gitignore style pattern matching of file paths

Added to portage

2026-01-07

portage - 3.0.75
Ebuild name:

sys-apps/portage-3.0.75

Description

The package management and distribution system for Gentoo

Added to portage

2026-01-07

prowlarr-bin - 2.3.2.5245
Ebuild name:

www-apps/prowlarr-bin-2.3.2.5245

Description

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

Added to portage

2026-01-07

py-spy - 0.4.1
Ebuild name:

dev-util/py-spy-0.4.1

Description

Sampling profiler for Python programs

Added to portage

2026-01-07

pyfuse3 - 3.4.2
Ebuild name:

dev-python/pyfuse3-3.4.2

Description

Python 3 bindings for libfuse 3 with asynchronous API

Added to portage

2026-01-07

pytest-golden - 1.0.1
Ebuild name:

dev-python/pytest-golden-1.0.1

Description

Plugin for pytest that offloads expected outputs to data files

Added to portage

2026-01-07

radarr-bin - 6.1.1.10317
Ebuild name:

www-apps/radarr-bin-6.1.1.10317

Description

A fork of Sonarr to work with movies a la Couchpotato

Added to portage

2026-01-07

rpm - 6.0.1
Ebuild name:

app-arch/rpm-6.0.1

Description

The RPM Package Manager

Added to portage

2026-01-07

sbctl - 0.16
Ebuild name:

app-crypt/sbctl-0.16

Description

Secure Boot key manager

Added to portage

2026-01-07

strscan - 3.1.7
Ebuild name:

dev-ruby/strscan-3.1.7

Description

Provides lexical scanning operations on a String

Added to portage

2026-01-07

tarlz - 0.29
Ebuild name:

app-arch/tarlz-0.29

Description

A parallel archiver combining tar and lzip

Added to portage

2026-01-07

tayga - 0.9.6
Ebuild name:

net-proxy/tayga-0.9.6

Description

Out-of-kernel stateless NAT64 implementation based on TUN

Added to portage

2026-01-07

thor - 1.5.0
Ebuild name:

dev-ruby/thor-1.5.0

Description

Simple and efficient tool for building self-documenting command line utilities

Added to portage

2026-01-07

uv - 0.9.22
Ebuild name:

dev-python/uv-0.9.22

Description

A Python package installer and resolver, written in Rust

Added to portage

2026-01-07

uv-build - 0.9.22
Ebuild name:

dev-python/uv-build-0.9.22

Description

PEP517 uv build backend

Added to portage

2026-01-07

wget2 - 2.2.1
Ebuild name:

net-misc/wget2-2.2.1

Description

GNU Wget2 is a file and recursive website downloader

Added to portage

2026-01-07

xmlschema - 4.3.0
Ebuild name:

dev-python/xmlschema-4.3.0

Description

An XML Schema validator and decoder

Added to portage

2026-01-07

xvfbwrapper - 0.2.17
Ebuild name:

dev-python/xvfbwrapper-0.2.17

Description

Python wrapper for running a display inside X virtual framebuffer

Added to portage

2026-01-07

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