Simple introduction to Linux common operation commands

Source: Internet
Author: User

# First, let's introduce the Vim text editor

# It is mainly to create files, documents, documents, files for editing, such as: In Windows, txt files, doc files and so on,//can write to the file content


# to give a simple example:

Vim Abc.txt//Create a Abc.txt document for the current directory

Vim/abc.txt//Create Abc.txt document for root


So how to look at the contents of the text:

Cat: The main view is text content

Cat/abc.txt//See what Abc.txt content is


#那么如何给里边写入内容

After using Vim to edit, then there are three modes

The first is: command-line mode

The second type is: Input mode

The third type is: the last line mode


# We usually first use VIM to enter this document, the default is the command line mode, and then input I into the input mode can write to the content, when we have finished writing, need to save and exit, then click the ESC key, back to the command line mode, click shift+ again: Then the last line mode, Enter Wq Save and exit


# Note that vim is entered into command line mode after default, the input mode must be exited to command line mode when switching to the last line mode, in order to switch

# Enter q! in the last line Exit does not save


# Simple to introduce you to the vim inside the copy, paste, delete

YY: Copy the current line

10yy: Copy current 10 rows

P (lowercase p): Paste to the bottom of the current cursor

P (or shift+p) pasted to the top of the current cursor

DD: Delete This line of the current cursor

10DD: Delete the current cursor 10 lines//include the current cursor line

#再给大家介绍一下 jumps between lines in command line mode, beginning of line, row not jumping


Home/shift+6//jumps to the beginning of the current cursor

end/shift+$//jumps to the end of the line at the current cursor

GG//Jump to the first line of the file

G/shift+g//Jump to the last line of the file


# Let me introduce you to the simple operation of the last line,


Set nu//Display line number

Set Nonu//Do not display line numbers

/10: In line Input/10, the cursor jumps directly to line tenth

S/root/new//means to replace the first root of the current row with the new one

S/root/new/g//means to replace all root of the current line with new

% s/root/new/g//means to replace all root of the current file with new


# Here's a simple introduction to the creation of user groups, and the creation of groups


Useradd Lili//create user Lili

Ls/home//Display home directory for normal users

ID Lili//view user's identity

GPGROUPADD ABC//group to create ABC

GPASSWD-A Lili ABC//Add user Lili to the LABC group

GPASSWD-D Lili ABC//Remove Lili user from the group

Su-lili//Switch User directory

Usedel-r Lili//delete user

Usermod-l Koufei Lili//replace Lili user with new user


# The following describes the production. Tar package, compress and decompress the TAR package


tar-zcf/opt/boot_back.tar.gz/boot///The boot directory is compressed and compressed into boot_back.tar.gz

tar-jcf/opt/boot_back.tar.gz2/boot///The boot directory is compressed and compressed into BOOT_BACK.TAR.GZ2

tar-jcf/opt/boot_back.tar.xz/boot///The boot directory is compressed and compressed into BOOT_BACK.TAR.XZ


# Summary: The above is the tar package of three different compression methods


# Universal Decompression Formula

Tar-xf/opt/boot_back.tar.gz-c/ROOT/ABC//extract boot_back.tar.gz to/ROOT/ABC


# no matter the compression method can be extracted with TAR-XF


# below is a description of local Yum source

mount/dev/cdrom/opt///Mount

Vim/etc/yum.repos.d/kf.repo

# as shown:


"KF"

Name=kf

baseurl=file:///opt/

Enabled=1

Gpcheck=0



Verification: Yum Replosit//as shown


# above is the local Yum source


# then you can install the software,


Yum-y Install httpd//installation httpd software


# re-introduce user permissions on directory files

MKDIR/OPT/ABC//Create directory ABC

ls-ld/opt/abc///Query/opt/abc/file properties to see what permissions


Root: Owner has rwx right County

Root: Group has ro right County

Others: With RX permission


# r: Read

W: Write

x: Meaning of the execution


# Change the/opt/abc/directory permissions, so that the owner as long as the RW permission, belong to the group as long as R permissions

U=uid//Owner

G=gid//Genus Group


chmod u=rw,g=r/opt/abc/


#那么是如何让一个用户即拥有属主权限, with group permissions


: To give a simple example,

# If the user Lili the owning group, and the master permission

First to see if there is a Lili this user, if there is no need to create

ID Lili//view Lili Identity


Useradd Lili


Chown lili:lili/opt/abc///Make Lili owned group, owner's permission


*_____________________________________________________________________________________*

I'll write it down today.


          

Simple introduction to Linux common operation 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.