Find,vim programming settings, Suid,sgid,sbit, soft. Hard links, redirection

Source: Internet
Author: User
Tags stdin

1. Find command:

basic format: Find path option parameter

-name: Search by file name

-size: Search by File size + (bigger than this)-(smaller than this)

-type: Find by file type-normal file-D directory-L link file-C character device file-B block device file-P pipe file

-uid: Based on the user's UID lookup

-gid: Query According to the group that the user belongs to

-nouser: Query does not belong to the user's

-nogroup: Query does not belong to group

-perm: Search by permissions

Finally, you can-exec the command {} \; perform some required execution.


2. Vim Programming settings

Set line number

Set Nu

Auto Indent

Set Autoindent

Set Cindent

The width of the TAB key

Set tabstop=4

Unified Indentation is 4

Set softtabstop=4

Set shiftwidth=4

Provide automatic indentation for C programs

Set Smartindent


3, SUID SGID sbit

SUID is file-specific and can be set to/4 on the owner's X (executable bit) X->s/_->s,u+s, which represents the right to have the owner of the file.

SGID is for files, directories are available, mainly for the directory, in the owning group X (executable bit) X->s/_->s,g+s can be set/2 can also, represents the file created in this directory with this directory has the same group.

Sbit is for the directory, in the other user's X (executable bit) x->t/_->t,o+t can be set/1 can also, on behalf of other users can only read the files in the directory, can not be modified and deleted, only the creation of their own can be read, write, modify, delete and other operations


4, soft, hard link: Need ln this command.

Hard link: The same file of different fen, inode only one, equivalent to only one file, all through the pointer, a change completely, only to the same directory, can not be the directory of other file system.

Format: ln original file name hard link name

Soft connection: Two different files, soft connection files are stored in the path of the connection file, the original file is deleted, the soft connection file cannot be viewed, soft connection can be directory, file, and different file system.

Format: Ln-s original file name hard link name

Inode number: All files and directories in the Linux file system have a unique number. A hard-link file refers to the text stored in the

Files with the same inode number under different paths in the system , the nature of the hard-link file is: Although the different bits stored in the file system

But it is the same file. is equivalent to a file in the file system of a number of fen, there is no direct

Relations. However, manipulating one of these files is equivalent to manipulating the same file in different locations. Only when all the hard-linked files are all

have been dropped by RM , this file is really deleted.


5. redirect

Redirect: Re-specify the direction for standard input (stdin)/ standard output (STDOUT)/Standard error (stderr). Whether the standard input /

Which of the standard output / standard errors is the flow of data, and the flow of data is directional (from where to where).

standard output is a default data flow destination (default is the standard output device), the standard output device Linux refers to /dev

A device file (character device file) under the directory. The standard output data produced by any executable program is written to this

Some equipment

The file.

stdin ( 0), stdout (1), stderr (2)

REDIRECT standard output: Changes the destination of the standard output to any possible file (redirected to the destination of the standard output). =

REDIRECT Symbol
Related explanations Use form
corresponding explanation
> REDIRECT standard output (override feature) Path to command > file If the file corresponds to a path that does not exist, the file is created and, if it exists, the contents of the file are emptied first, and the standard output is written to the file.
>> REDIRECT standard output (Append attribute) Path to command >> file If the file corresponds to a path that does not exist, the file is created and, if present, the contents are not emptied, and standard output is appended to the end of the file.


The standard input is the default data source (default is the standard input device) and the standard input device Linux refers to the /dev directory

A device file (character device file). When any executable program executes, it is possible to read the number from a standard input device

According to the fact

is to read the contents of the standard input device file.

REDIRECT Standard input: Changes the source of the standard input to any possible file (the source of the standard input is redirected).

REDIRECT Symbol
Related explanations Use form corresponding explanation
< REDIRECT Standard input Command < file path
<< REDIRECT standard input, can use pseudo terminal Command <<! Several file contents

! Indicates that the pseudo-terminal is turned on and off. You can write arbitrary content in the middle, which becomes the standard input for the command.

Rational use of redirects

REDIRECT output: (1). Save the standard output of the command to a file (2). The redirect produces multiple intermediate files, making multiple life

To work together.

The implementation of the internal redirection: the main use of two functions (but need to understand three), the main principle of implementation is to ask the description of the copy technology

operation. The functions used are:dup,dup2,fcntl(This function can replace the DUP and dup2).

Combined with & , standard errors and standards can be combined to output to the same file.


Find,vim programming settings, Suid,sgid,sbit, soft. Hard links, redirection

Related Article

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.