Linux basic commands

Source: Internet
Author: User

  1. Please copy the/etc/init.d/iptables to the/root/directory and rename it to Test.txt:

    Cp/etc/init.d/iptables Test.txt

    MV Iptables Test.txt

  2. Open Test.txt with vim and set line number:

    Vim Test.txt

    : Set Number

  3. Move down, up, left, and right 5 characters: arrows or j,k,h,l

  4. Two pages down and up, respectively: ctrl+f; Ctrl+b; PageUp; PageDown

  5. Move the cursor to line 49th: 49G

  6. Move the cursor to the end of the line, and then move to the beginning: shift+4; 0 or Shift+6

  7. Move to the last line of the Test.txt file: G

  8. Move to the first line of the file: GG

  9. Search for the iptables that appear in the file and count the total number of occurrences:

    Gg

    /iptables Enter, press N to find the next

  10. Replace the iptables from the first line to the third row with the iptable:

    : 1,3s/iptables/iptable/g; #不加g仅替换每一行第一个, add g to replace all

  11. Restore previous action: U

  12. Replace all iptables in the entire file with iptable:

    : 1, $s/iptables/iptable/g

  13. Move the cursor to line 25 and delete the character "$":

    25G

    Press I to enter edit mode to delete.

  14. Restore previous action: U

  15. Delete Line 50th:

    50G

    Dd

  16. Restore previous action: U

  17. Delete everything from 37 rows to 42 rows:

    37G

    6dd

  18. Restore previous action: U

  19. Copy the 48 lines and paste them below the 52 lines:

    48g;yy;52g;p; P Copy the data from the next line of the cursor paste, p from the previous line

  20. Restore previous action (press two times u)

  21. Copy the contents from 37 rows to 42 lines and paste them above the 44 lines:

    37G

    6yy

    44G

    P

  22. Restore previous action (press two times u)

  23. Move the contents of rows 37 to 42 below the 19 line:

    37G

    6dd

    19G

    P

  24. Restore previous action (press two times u)

  25. Move the cursor to the first line and change the/bin/sh to/bin/bash:

    Gg

    Press I to enter edit mode to modify

  26. Insert a new line below the first line and enter "# hello!" :

    Press the letter O and enter "hello!"

  27. Save the document and exit:

    : wq!


This article is from the "Llinux Command Contact" blog, please be sure to keep this source http://2767215.blog.51cto.com/2757215/1948226

Linux basic commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.