0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[Linux][command] viエディタ_vi

Last updated at Posted at 2025-02-02

入力モード

コマンドモード

カーソル操作

コマンド 由来 説明
h ← left 左へ1文字移動
l → right 右へ1文字移動
k ↑ up 上へ1行移動
j ↓ down 下へ1行移動
0 beginning of line 行頭へ移動
$ end of line 行末へ移動
H Head of screen 画面の先頭へ移動
L Low of screen 画面の最下部へ移動
gg go to the beginning of file ファイルの先頭へ移動
G go to the end of file ファイルの末尾へ移動
nG go to line n n 行目へ移動
:n go to line n in ex mode n 行目へ移動

viの終了、ファイル保存、シェルコマンドの実行

コマンド 由来 説明
:q quit 保存せずに vi を終了(未保存の変更があるとエラー)
:q! quit (force) 変更を破棄して強制終了
:w write ファイルを保存
:wq または :x write & quit ファイルを保存して vi を終了
:!コマンド shell command vi を終了せずにシェルコマンドを実行
:sh shell 一時的にシェルに移行(exitvi に戻る)

編集

コマンド 由来 説明
x カーソル位置の文字を削除
X カーソル位置の手前の文字を削除
dd delete line カレント行を削除する
dw delete word カーソル位置から次の単語までを削除
yy
p put after カレント行の下or右にバッファの内容を貼り付ける
P put before カレント行の上or左にバッファの内容を貼り付ける
r

Ping-t

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?