linux-file, directory Management

Source: Internet
Author: User
Tags file permissions

Directories and Paths

    • . This layer directory
    • .. Upper Directory
    • -Previous working directory
    • ~ Home Folder
    • ~ account Specifies the user's home folder, accounts--name
    • CD Switch Directory
    • PWD (Print working directory) displays the current directory
    • mkdir Create a new directory
        • Mkdir-p T1/t2/t3 Creating a multi-tiered catalog
        • MKDIR-M 711 T1 Create file permissions
    • RmDir Delete an empty directory
        • Rmdir-p T2 together with delete upper empty directory
    • Environment variable: the command that $PATH executes will find the relevant command according to this path, and return it. Echo $PATH

File directory: LS

    • Ls-a All Files
    • Ls-a All Files! =. || ..
    • Ls-d listing the directory itself
    • Ls-f not sorted
    • Ll-al View Detail Instructions LL

Copy, delete, move: CP, RM, MV

    • Cp-a equivalent to-PDR
    • Cp-i overwrite existing files before asking
    • Recursive replication of Cp-r subdirectories
    • Cp-p file attributes are copied together for backup
    • Cp-l creating shortcuts, hard links
    • Cp-s creating shortcuts, soft connections
    • Rm-f ignore files that do not exist
    • Rm-i Interactive mode, reminder action
    • Rm-r Recursive deletion
    • Mv-f forced override
    • Mv-i Inquiry
    • Mv-u Update

File Content Query

  • Cat starts displaying file contents from the first line
      • -a special character display equivalent to-vet
      • -B line number, blank line does not count
      • -e Display break characters $
      • -N Print line number, blank line is also counted
      • -T tab display ^i
      • -V lists days special characters
  • The TAC starts with the last line showing
      • TAC is the opposite of cat
  • NL output line number when displayed
      • -B A blank line also displays the line number; Nl-b T blank line does not display line number
      • -N-Ln line number on the left of the screen; Nl-n RN line number in the right side of the field, without 0;nl-n RZ to add 0
      • The number of digits occupied by the-W line number
  • More one Page one page display
      • Space page
      • Enter Scrolls one line
      • : F file name and current line count
      • Q exit
      • B or Ctrl-b back page
      • /string current display, query string down
  • Less with more, but you can page ahead
      • Space page
      • PageDown down one page
      • PageUp up a page
      • Look up and down before and after
      • /String down query
      • ? string up Query
      • n Repeating last Query
      • N Reverse Repeating previous query
      • Q exit
  • Head first few lines, row-level units to select
      • n the number of rows displayed, default 10
  • Tail end a few lines
      • -N After a few lines, default 10
      • -F Continuous Monitoring
  • OD binary mode read
      • -T Output type

Modify file time or create a new file: Touch

    • Three more important time parameters: Ls-l The default is Mtime
        • Modification Time (Mtime): This is updated when the contents of the file are changed. --File contents
        • Status Time (CTime): File status times--Permissions and properties
        • Access Time (atime): File is fetched, updated-such as cat read
    • Modified: The touch file does not exist and will automatically create the file
        • -A access time
        • -C File Time
        • -D date and time to be modified, or--date (date or time)
        • -M Modify Mtime
        • -T modification time [YYYYMMDDHHMM]

Default permissions and hidden permissions for files and directories

    • Set hidden properties chattr; View hidden properties: lsattr

Default permissions for files Umask: Specifies the default value of permissions currently in the new file or directory (fractional refers to the permissions that need to be lost)

    • View default permissions: Umask; Umask-s
    • Set default permissions: Umask Current user Rights score user Group permission score other user group score; The score you set is the privilege score that needs to be lost on the default basis.

        

        • Umask-p umask-s Command
        • Umask umask 022 The original default permissions are all permissions, now set to the current user group full permissions, the user group minus 2=w permissions, other user groups minus 2=w permissions

File hiding properties Charrt, lsattr

    • chattr [+-=] [Asacdistu]
        • + Add a special parameter, other existing parameters will not move
        • -delete a special parameter, other existing parameters do not move
        • = re-assignment parameter
        • A access time Atime will not be modified to reduce IO read/write
        • S Synchronous Write to disk
        • A root to set this property, only add or subtract data, cannot delete and modify
        • C Storage, the first compressed files in the storage, read the first decompression and then read
        • D can skip backup
        • I let the file cannot be deleted, renamed, set connection, unable to write data, add data
        • s remove files completely when deleting them
        • U and S opposite
    • lsattr [-adr]
        • -A Show hidden file properties
        • The properties of the-D directory itself
        • -R is displayed along with subdirectories

Viewing file types: Files

    • Query for script file name: Which [-a] command
    • File name lookup: Preference Whereis, database query fast, but will not find new additions
        • -B Find binary format files only
        • -M only look for files under the description file manual path
        • -S Find source file only
        • -U find other special files that are not in the above three options
    • File name lookup: followed by locate, with Whereis
        • -I ignores case-sensitive queries
        • -R Regular Expression
    • File name lookup: Last Find, find [Parh] option] [action], read disk speed down

.... Continue to add ....

linux-file, directory Management

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.