zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    QTP问题:查询文件被占用
    QTP自动化
    Spring: $Proxy9 cannot be cast to test.spring.service.impl.PersonServiceImpl2
    spring: White spaces are required between publicId and systemId.
    spring学习1
    MyBatis学习(1)
    从技术人员的角度看,公司怎么生存?
    一天一工程总结系列-7.7-KVOController
    appCode使用说明
    ios开发中的字符串常量如何处理
  • 原文地址:https://www.cnblogs.com/thlzhf/p/3441516.html
Copyright © 2011-2022 走看看