Linux file and directory operations management commands

Source: Internet
Author: User
Tags control characters create directory compressed file types

1. PWD: Show working directory path

    • -P: Show actual physical path
    • -L: Show link path

2. CD: Change the working directory path

    • CD: Go to User's home directory
    • cd~: Go to User's home directory
    • cd-: Returns the directory where it was before entering this directory
    • CD: Return to Parent directory (if current directory "/", then "/" after execution)
    • Cd.. /.: Return to top level two directory

3, LS: List directory and file information

    • -a: Displays all subdirectories and files in the specified directory, including hidden files
    • -c: Mate Lt Sort by CTime and show CTime
    • -d: If the parameter is that the directory displays only its name and does not display the files and subdirectories under it
    • -f: Show file Types
    • -i: Displays the inode number of the file in the first column of the output
    • -l: Show file details in long format
    • -r: Preserving order when sorting
    • -t: Sort by modified time
    • -s: Sort by file size
    • -s: Displays the size of each file allocation in blocks

4, Touch: Create an empty file, change the time of the file

    • -A: Modify Atime time
    • -M: Modify Mtime time only
    • Atime: Access Time
    • Mtime: Modification Time
    • CTime: Change Time

5. mkdir: Create directory

    • -m< Permissions mode: Set permissions on the newly created directory, the default permission is 755 when the-M option is not available
    • -V: Displays information each time a new directory is created
    • -P: Can be a path name (you need to create a multilevel directory at once)

6. RmDir: Delete Empty directory

    • -P: Recursively deletes the directory, and when the neutron directory is deleted, its parent directory is empty and is deleted together
    • -V: Output processing directory details

7. RM: Delete files (directory)

    • RM command to delete a file or directory
    • -F: Force delete (even if the-I property is set)
    • -R: Delete Directory
    • -I: whether to ask before deleting files or directories

8. CP: Copy files and directories

    • -A: Preserves links, file attributes, and recursively replicates directories when replicating directories, equivalent to the-DPR option
    • -D: Keep links when copying
    • -F: Mandatory replication
    • -r: Copy directory
    • -L: Do not copy, just link file
    • -I: whether to ask before copying files or directories
    • -U: Copy only if the source file is newer than the destination file

9. MV: Renaming files and directories, moving files and directory paths

    • The MV command is used to move a file (directory) or to rename a file (directory)
    • $ mv The file destination path to move
    • $ MV Original filename new file name

10. Install: Copy files and set properties

  • -C: Compares each set of source and target files, and in some cases does not modify the target file
  • -D: Treat all parameters as directory names: Create all components for the specified directory
  • -D: Create all the necessary parent directories for the destination directory, and then copy the source files to the directory
  • -G: Set the owning group yourself instead of the group to which the process currently belongs
  • -M: Self-setting mode (like chmod) instead of Rw-xr-xr-x
  • -O: Self-setting owner (for super users only)
  • -P: Modify the Access modification time of the source file to match the target file
  • -S: disassemble symbol table
  • -S: Overwrite common backup file suffixes
  • -T: Copy all parameters of the source file to the specified directory
  • -T: Treat the target file as a normal file
  • -V: Displays the name of the directory when it is created

11. Tmpwatch: Delete files that have not been accessed within the specified time period

  • Use the Tmpwatch command to search recursively from a specified directory and delete files that have not been accessed within a specified time period
  • -A: Delete any type of file
  • -F: Forcibly deleting files or directories
  • -Q: Do not show the command execution process
  • -V: Verbose display of the command execution process
  • -T: only function test, do not really delete files or directories
  • -M: Based on file modification time (mtime)
  • -C: Change time according to file file (CTime)
  • -M: Based on folder modified time (Mtime)
  • -L: Do not delete symbolic links
  • -u< user;: Exclude files from specified users
  • -x< path: Exclude specified path
  • -x< string;: Exclude path to match string
  • -D: Do not delete empty directories

12. File: type of query files

    • -V: Displays the version information after the standard output and exits
    • -Z: Probing compressed file types
    • -L: Allow Symbolic links
    • -B: The file name is not displayed when the distinguished result is listed
    • -C: Verbose display of command execution procedures to facilitate troubleshooting or analysis of program execution
    • -I: Show MIME type
    • -f< name file: Read the list of file names to parse from the file
    • Note: What is a MIME type
    • A MIME type is a type of file that sets an extension that is opened by an application, and the browser automatically opens with the specified application when the file is accessed. Many are used to specify some client file names and how some media files are opened.

13. Du: Displays the disk footprint of a directory or file

  • -A: Displays the size of individual files in the directory.
  • -B: In bytes when displaying a directory or file size.
  • -C: Displays the sum of all directories or files in addition to the size of individual directories or files.
  • -K: Output in kilobytes (1024bytes).
  • -m: output in megabytes.
  • -S: Displays totals only, listing the last plus total value only.
  • -H: Improve the readability of the information in k,m,g units.
  • -X: The file system at the beginning of processing, if encountered in other different file system directory is skipped.
  • -l< Symbolic link > or--dereference< symbolic link;: Displays the source file size of the symbolic link specified in the options.
  • -S: Displays the size of individual directories without the size of their subdirectories.
  • -x< file: In < file > specify directory or file.
  • --exclude=< directory or file;: Skips over the specified directory or file.
  • -D: Displays the source file size for the specified symbolic link.
  • -H: The same as the-h parameter, but the k,m,g is converted to 1000 units.
  • -L: Duplicate the hardware linked file.

14, WC: Statistics file number of lines, words, bytes and characters

    • -L: Count rows
    • -W: Statistical word Book
    • -C: Statistics of bytes
    • -M: Statistics of characters
    • -L: The length of the longest line in the statistics file

15. Tree: The contents of the catalogue are listed hierarchically

  • -A: Displays all files and directories.
  • -A: Use Asni drawing characters to display a tree instead of an ASCII character combination.
  • -C: Add color to the list of files and directories to make it easy to differentiate between types.
  • -D: Displays the directory name instead of the content.
  • -D: Lists the time that the file or directory was changed.
  • -F: Displays the full relative path name before each file or directory.
  • -F: In the execution of files, directories, sockets, symbolic connections, pipe name names, respectively plus "*", "/", "=", "@", "|" No.
  • -G: Lists the name of the group to which the file or directory belongs, and when there is no corresponding name, the group identifier is displayed.
  • -I: Do not list file or directory names in ladder form.
  • -i< template style;: does not display file or directory names that conform to the template style.
  • -L: If you encounter a directory with a symbolic connection, directly list the original directory that the connection points to.
  • -N: Do not add color to the list of files and directories.
  • -N: Lists file and directory names directly, including control characters.
  • -P: Lists the permission marks.
  • -p< template style;: Displays only files or directory names that conform to the template style.
  • -Q: With "?" control characters, listing file and directory names.
  • -S: Lists the file or directory size.
  • -T: Sorts the changes in file and directory times.
  • -U: Lists the owner name of the file or directory, and displays the user ID when there is no corresponding name.
  • -X: Confine the scope to the current file system, and if some subdirectories under the specified directory reside on another file system, the subdirectory is excluded from the search scope.

Linux file and directory operations management commands

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.