Linux file Management class commands, types, user Rights Management and bash Shell features: command aliases, filename wildcard

Source: Internet
Author: User
Tags aliases clear screen control characters echo command

File Management class commands

Ls

View: Cat tac more less head tail

Copy: CP

-R: Recursive

-I: Hints, interaction

-F: Forced override

-A: Keep all file information

-D: When the source is a linked file, the link itself is copied instead of the source file

-P: Keep the original property

Delete: RM

Delete a non-empty directory Rm-rf

Mobile: MV

Create: Touch

Used to modify timestamps, create empty files

-C: Do not create a new file, only modify the timestamp

-A: Modify access time only

-M: Modify the modification time

-T: Specify timestamp

First-M plus-T followed by time

Meta Data properties: Stat

Display file meta data information, more information

Stat file

View Content Type: File


File type

Normal file:-,f

Catalog File:d

Link file: L (soft connection)

Device files

Character Device: C

Block Device: b

Named pipes: P

FI, FO

Socket file:


Linux file Timestamp:

Access time

Modification Time: Write data

Change time: Time of metadata change


LS: Select the current directory by default

-A: Show all files, including hidden files

-A: Not realistic, and. Common generic paths

--color: Display color

-L: Long format display

-D: Displays the properties of the directory itself, usually in conjunction with-l

-r: Enables reverse display

-R: Recursive display

-i:inode, index node

-H: File size, displayed in a human readable manner

Tree: Shown in trees


Name resolution: Name Resolving


Features of bash: command aliases

Clear: Clear Screen

Alias: All aliases defined in the current shell

Any attributes that occur with the process will end in the process and the property disappears

Alias command = ' original command '

Unalias aliases: Aliases that are undefined

Add \ Use the command itself before the command, not the alias


Only plain text files can be viewed

File files ...: View the format of the contents

Cat: Connect text to display on standard output

control characters such as line break

-E: Display Terminator $

-V: Display nonprinting characters

-e: Equivalent to-ve

-N: Displays the sequential number of each line

-S: Merge multiple contiguous blank rows to display a blank line

TAC: Reverse Display

MORE: Support backward only (after file tail)

Less: Supports front and rear rollover

Head

-n#: How many lines before display

Tail

-n#: How many lines are displayed after


Use of the echo command

-E

\b: Delete the preceding character

\ t; tab

\v: Vertical tab

\ n: Line break

\onnn

Start \033[# #

# 1-7 Front View

# # Background Color

End \033[0m

-N: Do not wrap text for display


File operations

CP src Dest

If SRC is a file

If the target is a file and the target exists, overwrite

If the destination file does not exist, create a new file

If the target exists and is a directory, copy the source to the destination directory and keep the original

If SRC has multiple files

If the target is a file and the target exists, replication cannot be completed

If the destination file does not exist, replication cannot be performed

If the target exists and is a directory, copy the files to the destination directory and keep the original

If SRC has only one, and it is a directory-r

If the target is a file and the target exists, replication cannot be completed

If the destination file does not exist, create a new directory

If the target exists and is a directory, copy the files to the destination directory and keep the original


Features of the bash shell: globbing, file name wildcard

*: matches any character of any length

? : Matches a single character

[]: matches any single character within the specified range of characters, not case-sensitive

[[: Upper:]] Uppercase

[[: Lower:]] lowercase letters

[[: Alpha:]] uppercase and lowercase letters

[[: Digit:]] Number

[[: Alnum:]] Mixed alphanumeric

[[: Space:]] Space

[[: Punct:]] punctuation special characters

[^]: matches any single character outside the specified range of characters


Practice:

  

      

Copy/etc directory starting with p, with any characters in the middle, and files ending in D to the/tmp directory
#cp-R/etc/p*d/tmp
Copy/etc directory starting with P, followed by 4 arbitrary characters, and the file ending in D to the/tmp/a directory: If a does not exist, create it first
#mkdir/tmp/a
Cp-r/etc/p???? d/tmp/a
Copy/etc directory starting with any digit and ending with a non-numeric file to the/tmp/b directory
#mkdir/tmp/b
Cp-r/etc/[[:d igit:]]*[^[:d igit:]]/tmp/b
Copy/etc directory with non-letter start, followed by a letter and any other length of the file into the/TMP/C directory
#mkdir/TMP/C
Cp-r/etc/[^[:alpha:]][[:alpha:]]*/tmp/c

      



Linux file Management class commands, types, user Rights Management and bash Shell features: command aliases, filename wildcard

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.