Linux with Operating System Concepts



Download 5,65 Mb.
Pdf ko'rish
bet62/254
Sana22.07.2022
Hajmi5,65 Mb.
#840170
1   ...   58   59   60   61   62   63   64   65   ...   254
Bog'liq
Linux-with-Operating-System-Concepts-Fox-Richard-CRC-Press-2014

insert
and 
replace
. In insert, any character entered is placed at 
the current cursor position while in replace, any character entered replaces the character 
at the current cursor position. To move from insert or replace back to command, press the 
escape (
<
Esc
>
) key. What we will see below are the commands that control vi, that is, that 
are applied in the command mode. At any time, if you are in insert or replace, the keystrokes 
correspond to characters to be entered at the position of the cursor except for 
<
Esc
>
.
The basic cursor movement commands are shown in Figure 5.1. The keys 
h

k

l
, and 
j
move the cursor left, up, down, and right on one position, respectively. The key 
0
moves the 
cursor to the beginning of the current line and the key 
$
moves the cursor to the end of the 
current line. The 
^
key moves the cursor to the first nonblank character of the line so that 
for a line starting with a nonblank, 
0
and 
^
do the same thing.
To reposition the cursor elsewhere, we have 
#G
where 
#
is a number. For instance, 
10G
repositions the cursor on line 10 and 
500G
repositions the cursor on line 500. If the num-
ber supplied is greater than the file’s size in line numbers, then the cursor moves to the 
bottom of the file. In any case, the cursor is positioned at the start of the line. The key 
G
by 
itself moves the cursor to the beginning of the last line in the file.
The key 
w
moves the cursor to the beginning of the next word or punctuation mark 
(whichever comes first) while 
W
moves the cursor to the beginning of the next word, ignor-
ing any punctuation. The key 
e
moves to the end of the word or a punctuation mark in 
the word while 
E
moves to the end of the word. The key 
b
moves to the beginning of the 
current word or punctuation mark in the current word while 
B
moves to the beginning of 
the previous word.
H

M,
and 
L,
respectively, shift the cursor to the top, middle, and bottom lines in the 
window. 
Control
+
u
(ctrl
+
u) and 
ctrl
+
b
change the view of the document to be one 
screen back or one-half-screen back while 
ctrl
+
f
and 
ctrl
+
d
shift the view to be one 
screen forward or one-half-screen forward. You can also refresh the screen using 
ctrl
+
r
or 
ctrl
+
l
(lowercase L) although these may not be implemented.


162

Linux with Operating System Concepts
Another means of movement to a new location in vi is to shift to a marked location 
within the document. To mark a location, use 
m
char
, where the 
char
indicates a label for 
the mark, as in 
ma
. To move to a marked location, use 

char
as in 
‘a
. This lets you mark 
numerous locations in a document.
There are a variety of commands available to enter insert and replace modes. The most 
basic three are 
r
(replace one character and then return to command mode), 
R
(enter 
replace mode and stay there), and 
i
(enter insert mode immediately before the location 
of the cursor). To move back to command mode from insert or replace, press 
<
Esc
>
. The 
other commands enter insert mode but do so at different locations.
The key 
I
moves the cursor to the beginning of the line to enter insert mode
a
and 
A
enter insert mode at the current cursor position and the end of the line, respectively. 
Finally, 
o
and 
O
insert blank lines and move the cursor to the new blank line, o creating 
the line immediately after the current line and 
O
creating the line immediately before the 
current line. Figure 5.2 illustrates these insert locations.
There are many cut, copy, and paste commands available. To delete the character at the 
cursor, use 
x
. To delete the word that the cursor lies in, use 
dw
. To delete the characters 
in the word that lie before the cursor, use 
db
. To delete the entire line that the cursor lies 
Basic cursor movements
n
is the line number, e.g., 5G for line 5
1G
n
G
G
0
k
j
h
1
$

Download 5,65 Mb.

Do'stlaringiz bilan baham:
1   ...   58   59   60   61   62   63   64   65   ...   254




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish