The Linux directory structure and the VI editor commands common operations

1. A detailed description of each directory, and place a whole directory structure here

/ Bin: Binary is an abbreviation for storing frequently used commands

/ Sbin: s representatives Super User, commands for system administrators use storage

/ Home: storage of the user's home directory ordinary, every user in Linux has its own directory, the directory name is based on the general user account named

/ Root: home directory administrator

/ Lib: system boot required basic dynamic link shared library, which is equivalent to the Windows system dll files, almost all applications will need to use these shared libraries

/ Lost + found: when the system is shut down illegal, some files will be stored here, under normal circumstances is empty

/ Etc: all systems needed for management configuration files and subdirectories

/ Usr: a lot of applications and user files are stored here, similar to the Windows program files directory

/ Boot: storing boot files of some of the core Linux boot

/ Proc: a virtual directory, the system memory map, you can access the directory system directly to obtain information

/ Srv: abbreviations service, the directory to store some of the data to be extracted after the service starts

/ Sys: This directory is only installed a 2.6 kernel only some of a new file system sysfs

/ Tmp: temporary file storage

/ Dev: all hardware in the form of files to store, the directory is to store these files

/ Media: Linux automatically recognizes the number of devices (such as: U disk and CD-ROM ...), will recognize the identification device mounted to this directory

/ Mnt: Let the system provides the user a temporary directory hanging in another file system, we can use an external storage mount to / mnt / down, and then enter you can see the contents of the

/ Opt: Linux to install additional software when placed in the directory.

/ Var: General store some files date, we will study the tube which is often modified to store log files to this directory

/ Selinux: This is a security subsystem that only he can control access to specific files program

2.VI/VIM Editor

  VI editor is the Windows equivalent to the inside of Notepad for editing text documents.

  When VIM editor VI upgrade, you can take the initiative to identify the grammatical correctness of the font color for easy programming.

 

The editor has three modes: namely, normal mode, edit mode, command mode

  2.1 General Mode

  

    With vi / vim to open a document directly into the general pattern of the (this is the default mode). In this mode, you can

  With "up and down" button to move the cursor, you can "delete character" with, "delete the entire line", "copy and paste" button

  To process the file content.

  Common Syntax

grammar

Functional Description

yy

Copy the current cursor line

Digital y y 

Copy the period (from a few lines to a few lines)

p

Paste line arrow to the object

in

Undo the last step

dd

Delete current line cursor

Digital d d

How many lines after the cursor is deleted (including)

x

To delete a letter, the equivalent of del

X

To delete a letter, the equivalent of Backspace

is

Copy a word

dw

To delete a word

shift+^

To move the line head

shift+$

Move to the end of the line

1+shift+g

Move to the header, the digital

shift+g

Move to footer

Digital N + shift + g

Move to the goal line

  Below is a detailed description from the Internet directly to the map

  

  2.2 Edit mode 

    It can be carried out in the general mode delete, copy, paste and other movements, but can not edit the contents of the file! Until you

  You will enter edit mode after pressing any letter "i, I, o, O, a, A", etc.

    Usually in Linux, when pressing these buttons will appear at the bottom left of the screen "- insert -" indication, this time before

  Editing. And if you want to return to normal mode, you must press the "Esc" button to exit the edit mode.

Common Syntax

1) to enter edit mode

button

Features

i

Before the current cursor

a

The current cursor

O

The next line of the current cursor row

I

Cursor line foremost

A

The last line where the cursor

O

On the current line of the cursor line

2) to exit edit mode

Press the "Esc" key

  2.3 Command Mode

    Among the general mode, enter ':? /' 3 in any of the buttons, you can move the cursor to the bottom of that most

  Row.

    Among this mode, you can provide "Search data" in action, and read, save, replace a large number of characters, leave

  vi, display line numbers such action is achieved in this mode!

1) The basic syntax

command

Features

:w

Storage

:q

drop out

:!

Enforcement

/ To find the word

A look - n, N look up

? To find the word

Find the n is a, shift + n is a look down

: Not set

Show Line Numbers

:set nonu

Close line number

2) Case practical operation

        (1)强制保存退出

:wq!         

2.4模式之间的转换

  

 

Guess you like

Origin www.cnblogs.com/juhaoyuan/p/11259382.html