Use of basic Instructions 3 Linux Edition

Source: Internet
Author: User
Tags touch command uppercase letter


/

/boot

/bin

/sbin

/lib.modules

/lib64

/etc/redhat-release

/etc/centos-release

/home/zczx

/mnt

/media

/misc

/proc/meminfo

/proc/cpuinfo

/proc/partition

/sya

/opt

/tmp

/usr/local/

/usr/share/man

/usr/share/doc

/usr/share/dict

/var/log/

/var/www

/var/ftp

/var

/dev/

Sda,sda1

/dev/null

/dve/zero

/dve/random

/dve/tty

/srv

/root


File wildcard characters

* Match 0 or more characters

? Match any single character

~ Current User Home Directory

~+ Current Working Directory

~-Previous working directory





[:d igit:] Any number, equivalent to 0-9

[: Lower:] Any lowercase letter

[: Upper:] Any uppercase letter

[: Alpha:] any case letter

[: Alnum:] any number or letter

[: Space:] Space

[:p UNCT:] Punctuation



ls/var/l*[[:d Igit:]]*[[:lower:]]

Ls-d/etc/[0-9]*[^0-9]

Ls-da/etc/*.d

Ls-da [nmrp]*.conf



Touch command


-A change Atime

-M Change Mtime

-c If the file exists on the refresh time, if not and does not create

-T

touch-d yesterday F2 F2 file yesterday's time, CTime does not change




CP command

A single file, where the source file is copied in a directory that does not exist, generates a copy file with the name of the nonexistent directory.


Copy directory has the same name of the file, the root user prompts you whether to overwrite, the ordinary user does not prompt, because Root uses the alias Cp-i

Cp-n If you have the same file, do not overwrite

Multiple source files CP must go to the actual directory that exists


Directory to use the-r option


-I: Interactive

-r,-r: Recursively copy directories and all internal content

-A: Archive,-dr--preserv=all

-D: Do not copy the original file, copy only the connection name

--preserv

Mode: permissions

Ownership: Belong to the main group

Timestamp: Time

All: Reserved

Links

Xattr

Context

All


-P: Equivalent--preserv=mode,ownership,timestamp

-V: The backup process is visible



CP--preserv=mode-r



Alias

Permanently valid after change to be placed in the configuration file

For the current user only: ~/.BASHRC


Valid for all users: ~/ETC/BASHRC



Moving and duplicate name files


MV core.3106/testdir/

-I: Ask if you are moving

-F: Force move


Rm


-F: Force delete

-R: Recursive (one delete)

Root user removal will ask you if you want to delete

A normal user will only be removed directly

#rm-RF/7 version will prompt you to operate the dangerous

Use RM-RF/* after version 7




Tree Directory

-D: Show only directories

-L Level: Specifies the number of levels to display

-P Pattern: shows only the path to which the specified pattern matches


mkdir Creating a Directory

-P: exist in no error, and can brake the creation of the necessary directories;



RmDir Delete Empty Directory

Ls-i

Inode number

The node number is unique in a partition and can be the same node number in different partitions.

Df-i can see how many inode numbers are in each partition

DF Look at the capacity of each partition



ln links

ln aa bb hard link AA to BB, the inode number is the same, the file content is the same size, the modification is the same.

If you delete one, the other one still exists. If all is deleted, the block data can still exist, but if new data is written, the old data is deleted, and a new link is added to restore the old data.


Data is divided into: metadata (placed in Inode table), data content (fast on block data)

Inode (index node) does not contain a list of all file system files

A node is a table item that contains information about the file (metadata), including:

File type, permissions, Uid,gid

Number of connections (point to the number of path names for this file name)

The size of the file and the different timestamps

Data block pointer to file on disk

Additional data about the file

Each partition has an inode table

Inode ENTRV entry Each record contains a pointer to a metadata block with 12 direct pointers, the last pointer pointing to the data, and a total of 12x4k=48k

Block size 4K each pointer points to a file block

Double pointer: In the 13th direct pointer to a file block, each file block has 1024 pointers, the last pointer pointing to the data, a pointer 4 K.

One heavy pointer: 1024x4k= 4M

Triple pointer: In the file block pointed to by the 13th direct pointer, 1024 file block pointers point to 1024 file blocks respectively, and the last pointer points to the data, and the pointer is 4K.

Double pointer: 1024x1024x4k= 4G

Triple pointer: 1024x1024x1024x4k= 4T

The number of layers to which the data is isolated is called an indirect pointer.



Hard links cannot span partitions, hard links cannot be connected to directories, but file directories can increase the number of links, each with one of the following: and itself under one.

-S for soft link (symbolic link)

Ln-s F1 F2

LL F1 F2

F2 Soft link to F1


Soft connections Cross partitions specify the path to the soft connection

Original file relative path: relative to the path of the soft connection file, rather than the path to the current working directory

LN-SV/ROOT/F1 testdir/f111

Path of original file soft link


File type check, determine file contents

File-b desktop/lists file identification results and does not display file names

-c verbose display of instruction execution for easy troubleshooting or analysis

-F Lists file types for file names in files

-F replaces the default ":" Delimiter with the specified delimiter symbol for the output file name

-I output MIME type string

-l view corresponding soft link file type

-Z try to interpret the contents of the compressed file

--help Display Command online Help



Standard I/O and piping


Program: COMMAND + data

Read-in data: Input

Outputs data: Output


The open file has an FD


Linux provides three I/O devices to Programs

Standard input-0 default input from the keyboard

Standard output-1 Default output to terminal window

Standard ERROR-2 default output to terminal window,

Redirect:

ls >/DVE/PTS/2 will display the output to the PTS2 terminal

ls > Ls.log Save the displayed output to the Ls.log file

>> f append does not overwrite



Ls. /xxx >/testdir/fi 2>/testdir/f1

The output of the command output to fi error to F1


>>

Set-c prohibit overwriting existing files, can append mandatory overwrite

Set +C allows overwriting


Ll/dve/null

LS xx/testdir/&>/tmp/all.log

LS xx/testdir/2>&1/>/tmp/all.log

&>>


Cat F1 Ls.log >F3

Put F1 and Ls.log together in F3


TR command

tr-Convert or delete characters



Mail-s + user name S denotes the mark

. Used for the end of mail


This article is from the "zczx_" blog, please be sure to keep this source http://swzczx.blog.51cto.com/11767585/1831612

Use of basic Instructions 3 Linux Edition

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.