Directory of basic Linux operations, VI, etc.

Source: Internet
Author: User

directories are used on file typesDmark, with/separates the directory layer, for eachShelland operating environment, there is a current working directory.

A directory is also a permission. (u,g,o)

Force bit s chmod u+x enforce permissions.

Adventure bit x chmod u+t Adventure Privilege

chmod 1777 A.txt

4(set uid)

2(set OID)

1(sticky + adventure Privilege)

/bin Store Common user executable commands

/boot Loader

/etc system administration and configuration Files

/PASSWD User Information

/shadow Shadow password

/group Group Information

configuration file for /initinit

/ Home Store personal master directory

/lib Repository file, dynamic link library

/lost+found: The usual thing is empty. Files left by the system's abnormal shutdown

/mnt common mount points for system loading of file systems

/OPT installation directory used by third-party tools

/proc a virtual directory, which is a mapping of system memory.

./meminfo

/cpuinfo

/filesystems File System Information

/sbin Store the commands used by the system administrator

Filter:

There are three types of application tools in Linux:

Interactive tools

Filter filters

Editor

A tool that can accept data and filter and re-export becomes a filter.

For filters and processes, there is an input source and an output object.

Input: Data source of the filter

standard input stdin(0): Default is keyboard

Output: Data whereabouts of the filter

standard output stdout(1): The default output is the terminal screen

Error Output:

standard error Output stderr(2): Output is a terminal screen

Redirection: Standard input and output, and error output, can be used to change the data source and whereabouts with a specific symbol.

use "<" to redirect input sources Cat < A.txt

use "<<" to have the system put all the keyboard input at once, first into the virtual document cat > File <<! (write script)

output redirection ls-l > a.txt outputs the LS display to the a.txt file and is not displayed on the terminal screen.

Ls-l >> a.txt append output.

Error Output redirect find/-type s 2>/dev/null processing useless files

SH test.sh >/dev/null 2 >&1

★ Pipeline:

Use | The output of the previous filter is fed directly to the input of the latter filter Example:ls-r | More

collocation grep ls |grep txt contains txt grep-v txt does not contain txt

File Lookup and file management

Which displays the executable full path of a file Whichls

Where is the Find command?

Locate keyword files and directories containing key fields are displayed for all file names on the machine path

slocate keyword

Find path parameter expression

Search files recursively down from the specified path, support search by various criteria

Find. -name file1 Exact search

Find. -name "*.txt" Fuzzy Lookup

Find. -perm 777 Search by Permissions

Find. -mtime documents modified within ten days

Find. -type f Only check ordinary files

Action found File

Find path parameter expression -exec directive {} \;

Find. -Name A.txt-exec rm{} \; Find a.txt and delete

Common file Operation directives:

WC Statistics file lines, words, words;

Wc-l count rows

Wc-w by word Count

Wc-c Statistics by character

grep Filtering

Sort Sorts -R Reverse order

Diff Report Text variance content

Comp Report Text difference location

Uniq Remove Duplicate row-C statistics in a file

Cut displays a column in a file cut-f 1-d ""

Paste text by column concatenation

Compression:

Gzip,gunzip

Bzip2,bunzip2

Z Series Instructions

Zcat Direct display of compressed file contents

Zless to display compressed file content straight-line

Zdiff Show the difference content of compressed files

zcmp

Tar command:

main parameter -C back up the file

-V Display file

-F

TAR-ZCVF Compression

TAR-ZXVF Decompression

Dump/restore

Backup and restore. Backing up to a file specified by /etc/fstab

Interactive tools

MESG Control terminal whether to receive messages

Write Oracle is sending messages to Oracle

Editing tools

VIM:

VI file name

instruction:Wq Save exit q! do not save exit e B.txt

Delete with block action: in command x delete a character DW delete a word dd Delete Row ndd Delete n rows

Press v to enter the Block command and then press C to Cut,p to paste, y to copy

s delete the cursor line and enter insert mode

U is cancel the last,u cancel all actions within one line,ctrl-r redo

E! Discard all changes, re-edit

Find text:/ Find content n Find Next ? Find content (find from end of head)

Input options for Command mode:

: R FileName This file is inserted at the cursor

: R! Command inserts the output of the command into the text

: Nr File Insert file to nth line

: Sh go to Shell command

: So files Read and write to the file before executing the instructions of the file

% Full text ^ beginning $ End G performance This line from start to finish

1. Cursor Positioning

2.ctrl V

6. "

4.I

5. Enter

6.ESC return

1.gg

2.c or D

6. "

Macro recording

1.qq

2.result

5.7

[Email protected]

Change inner

CIB or CI (or ci) Delete the parentheses in the

CA ( Delete the parentheses inside the brackets

Da (di ( does not enter Insert

Das

Cas


Directory of basic Linux operations, VI, etc.

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.