Use of cp, rm, and mv commands and cp commands in Linux Command lines
The following content comes from laruence's private kitchenCopy, delete, and move Linux Command lines: cp, rm, and mvCp (copy) replicationThe cp command is used for many purposes. In addition to simple copying, you can also create a link file to compare the old and new files and update them,And copy the entire directory.SyntaxCp [-adfilprsu] source file target fileSource)Destination File (destination)Option-A: equivalent to-
Common centos commands
Create a directory: mkdir-p [directory name]
Open Directory: cd [directory name]
(1) cd ~ Enter the Home Directory of the current user
(2) cd-enter the last directory
(3) cd .. go to the upper-level directory
(4) cd. Enter the current directory
View the current path: pwd
Delete Directory: rm-rf [directory name] (rm can only delete empty directories)
Copy: cp [Option] [directory or file] [target directory]
(1)-r: copy the Directory
(2)-p: copying the associated file att
In the last two weeks of July May, China's Internet of times (www. now.cn) cleared nearly 8100 spam-spreading websites based on the list of complained domain names mainly provided by castlecops.com.
It is reported that castlecops.com is a community of volunteer security, which focuses on promoting the security of the Internet, achieving collaborative information sharing among Internet institutions around the world, and jointly combating spam websites. All the public services provided by the i
(commonly used) before overwriting)-L create a hard connection file instead of copying the file itself-P is copied together with the file attributes, rather than the default attributes (commonly used for backup)-R recursive Continuous Replication, used for Directory Replication (commonly used)-S creates a symbolic connection to the source file instead of copying the file.-U if destination is earlier than source, update destination.-A is equivalent to-pdr
of-pdr;-D: If the source file is the attribute of the link file, the link file attribute is copied instead of the file itself;-F: For force, if there is any duplication or other doubt, the user will not be asked, but forced to copy;-I: If the destination file (destination) already exists, the overwrite will ask if the action is true!-L: The link file for the hard link is established, not the copy file itself;-P: Copy the past together with the attrib
Directory ManagementLS: View file directoryParameters:
-A: List all files, along with implied files
-D: Lists only the files themselves, not the files in the directory, and the PWD almost
-L: Lists Long data strings that contain data such as the attributes and permissions of the file, and in most versions ll is equivalent to Ls-l
CP: Copy file, cp parameter source file target fileParameters:
-A: equivalent to-PDR
-I
CP(copy files or directories)[Email protected] ~]#CP[-ADFIlprsu] Source file (source) destination Archive (destination)[Email protected] ~]#CP[Options] Source1 source2 source3 .... directoryParameters:-A: equivalent to the meaning of-pdr;-D: If the source file is a property of the linked file (linkfile), the link file attribute is copied rather than the file itself;-F: For force, if there is any duplication or other doubt, the user will not be asked,
. RmDir Delete Empty directoryOptions and Parameters:-P: Directly delete multi-layer empty directory, such as: Rmdir-p TEST1/TEST2/TEST36. CP Copy files or directoriesUsage1) CP option source file destination file2) CP option Source1 source2 source3 .... directoryOptions and Parameters:-A: equivalent to the meaning of-pdr;-D: If the source file is a linked file, the linked file is copied instead of the file itself, and the link to the source file is c
, not create file-D: date can be followed or --date="date or time" can be used -M: modify mtime only-T: can be followed by Time , in the format [YYMMDDHHMM]-CP, Copy command-----this option is typically used when copying a directory. It retains links, file attributes, and recursively copies the entriesEqual to the combination of-PDR options.--D If the source file is the disposition of the connection file , the copy retains the link instead of the f
------.2Root root6May - -: onTest2ls: Parameter-A is more than-a. and.-D directory itself, not listing contents-F list directly, do not sort by letter, etc. fast-F additional data structures, which are useful in certain non-color display terminals-H easier to read data size, humanreadable-I list inode numbers-L Long format-N Turn user,group information into Uid,gid-R Reverse Output-R recursion-S sorted by file size-T sorted by time--color=never,always,auto Color display Settings--full-time Full
ls [-ALIHD] file directory query the contents of the directory:-A: Show all files, including hidden files;-L: Show file details;-I: Display inode;-h: humanized display file size;-d: View Directory propertiesDirectory processing commandsmkdir [-MP] to create a new directory ,-m configuration file permissions, direct settings, do not need to see umask;-p help you directly to the desired directory (including the upper directory) recursive set up.CD directory switch directory,CD ~/CD switch home dir
source file.-V or--verbose displays detailed information when executed.-v=The--version-control=--help display Help.--version Displays version information.RM Command Parameters:-F,--force ignores nonexistent files and never gives hints.-I,--interactive for interactive deletion-R,-R,--recursive instructs RM to delete all directories and subdirectories listed in the parameters recursively.-V,--verbose detailed display of the steps performed --help Display this help message and exit --version outpu
default-A = = =-pdr-p copy files while keeping the file attributes unchanged, the measurements of the last toilet person is unchanged-R recursive replication, directory and future generations10.MV move moving files or directories-T moves all the original parameters to the11.RM Deleting files or directories-F Force forcibly removed, no prompt displayed-R Recursive recursive delete, delete directory12.find Finding files or directoriesfind/data/-type f-
removes. and. ;-H Displays the file size shown in KB,GB, and the-l displays detailed information, including file properties and permissions, and many distributions such as CentOS will set LL to Ls-l.CP command is used to copy files and directories, parameter-i if the target file already exists, the first query when overwriting;-D if the source file asks the properties of the connection file, copy the connection file properties instead of the file itself;-P along with the properties of the file
linux CP command parameters and usage details---linux copy file command CP [[Emailprotected]linux ~]# cp [-adf ILPR su ] source file (source) destination archive (destination) [[Emailprotected]linux ~]# CP [options] Source1 Source2 Source3. Directory parameter: -A: equivalent to-pdr meaning; -D : If the source file is the attribute of the linked file (link file ), the link file property is copied instead of the file itself; -F: For force If
First, view files and directories:1. Command format: LS [-aadffhilnrrst] directory name;2. Parameter Description:-A: Displays all files, including hidden files (hidden files usually begin with.).-D: Lists only the directory itself.-L: Lists Long data strings that contain data such as properties and permissions for the file.Second, copy command: CP1. Command format: CP [-ADFILPRSU] source file destination file2. Parameter Description:-I: If the target file already exists, ask before overwriting.-
Tags: LinuxDirectory processing command (bottom) Delete empty directoryrmdir【目录名】Delete a non-empty directory or filerm -rf 【目录/文件】-rDelete Directory-fForcedSimply rm or rm -r would you really want to delete files or directories?Do not hit rm -rf / will erase all files under the root directory!!!Copy commandcp 【选项】【原文件/目录】【目标目录】-rCopy Directory-pJoint file attribute replication-dWakahara file is a linked file, copy the link property-aEquivalent to-PDR
directory: CD. Or on the upper deck CD. /.. /go to the last directory CD-Tab key Auto-completePrint current directory: PWDDelete files: RM filename such as RM ABCDelete file avoid prompt: rm-f ABCrecursively delete the entire directory: RM-RF dir such as rm-rf/tmp/* delete all files (including directories) in the TMP directory if you do not add * means to delete the TMP directory directlyDelete Empty directory: RmDir dirnamecopy file and rename: CP Abc/tmp/abcs not renamed: CP abc/tmp/copy Enti
0. CP command (copy file or directory)1. # CP [-adfilprsu] source file (source) destination (destination)2. # CP [Options] Source1 source2 source3 .... directoryParameters:-A (archive): equivalent to the meaning of-pdr; do not change all properties of the source for archival replication, often used for backup; =--backup-D (no-dereference) : If the source file is the attribute of the linked file, the link file property is copied rather than the file it
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.