• RH033读书笔记(8)-Lab 9 Using vim


    Lab 9 Using vim

    Sequence 1: Navigating with vim

    1. Log in as user student

    2. [student@stationX ~]$ cp /etc/passwd ~

    3. [student@stationX ~]$ vim ~/passwd

    4. First, try moving around using such as the arrows, PgUp, PgDn.
    They should all work as expected. Note, however, that on older systems they might
    not.

    5. moving from word to word with the w and b keys.
    moving by sentence (the parentheses) and paragraph (the curly braces)

    6. Try combining numbers with movement keys.
    5w
    2Down Arrow

    7. Press the i key.
    The arrow keys, Home and End still move your cursor

    8. Exit insert mode by pressing Esc.

    9. Try pressing the u key. This will undo each change that you made. Changes can be re-done
    with Ctrl-r

    10. The ex mode is invoked by typing : while in command mode.

    11. At the ex prompt (:) enter set nu.

    12. Try entering ex mode again and typing :set nonu.

    13. Try jumping to line 5 by typing 5G.
    G to the end
    1G to the first line

    14. search feature: /root.
    press n and N to navigate.

    15. :set nohls.
          :set hls.

    16. Try running :q. :q!

    Sequence 2: Configuring vim

    1. [student@stationX ~]$ vim ~/.vimrc
    :set nu
    :set wrapmargin=10

    2. [student@stationX ~]$vim /etc/passwd again.

    Sequence 3: Configuring basic sudo privileges with vim

    1. [student@stationX ~]$ su -

    2. [root@stationX ~]# visudo

    3. /root
    The line appears about halfway down the file and looks like this:
    root ALL=(ALL) ALL

    4. yyp
    yy "yanks" (copies) the current line and p "pastes" it one line down.

    5. cw studen Esc.

    6. w cw stationX
    The line should now read:
    student stationX=(ALL) ALL

    7. Exit insert mode by pressing Esc. :wq

    8. [student@stationX ~]$ ls /etc/pki/CA
    ls: /etc/pki/CA: Permission denied

    [student@stationX ~]$ sudo ls /etc/pki/CA
    Password:
    private

    9. sudo will remember that you have already authenticated for five minutes before prompting you
    again.

    Challenge Sequence 4: Learning more with vimtutor

    1. [student@stationX ~]$ vimtutor

  • 相关阅读:
    MySQL常用函数介绍
    SQL语法基础之DROP语句
    MySQL常见报错汇总
    SQL语法基础之SELECT
    SQL语法基础之ALTER语句
    OpenStack技术栈-OpenStack的基础原理概述
    体验Hadoop3.0生态圈-CDH6.1时代的来临
    Windows下强制删除文件或文件夹(解除文件占用/Unlock)
    foreach Transform 同时chils.setParent引起的bug
    CharacterController平滑移动到某点
  • 原文地址:https://www.cnblogs.com/thlzhf/p/3441516.html
Copyright © 2020-2023  润新知