Copy, delete, and move commands for Linux files

Source: Internet
Author: User

Linux Common commands

1. Copy, delete, and move commands for Linux files
CP Copy, equivalent to "copy" in DOS
Usage: # CP [Options] source file or directory destination file or directory <Enter>
Common parameters:
-I interactive, inquiry mode. Whether to ask before overwriting
-R recursive, when copying the original folder is a directory file, the destination must be a directory name
# cp-i install.log/tmp<enter>//Normal
# cp-i install.log/tmp<enter>//Ask,<y> cover
# cp-r/root/tmp<enter>//Copy Folder

MV Move, rename, equivalent to "move" in DOS
Usage: # MV [options] source file or directory destination file or directory <Enter>
-I interactive, inquiry mode.
-F force, forced operation, not asked.
# Mv/tmp/install.log .<enter>//target exists, mobile
# Mv/tmp/install.log ./i3<enter>//target does not exist, rename

# CP I3/tmp<enter>
# mv-i i3/tmp<enter>//Enquiry
# mv-f A*.*/tmp/i3<enter>//Don't Ask

rm (remove) Delete files, folders, equivalent to "Del" in DOS
Usage: # RM [Options] File <Enter>
-I,-R,-F ibid. " -R "To remove all directories and subdirectories recursively, primarily for folders
# mkdir folder<enter>//Create Folder
# Touch folder/{a,b,c}<enter>//Generate ABC three files
# ls folder<enter>//Confirm 3 files
# rm-i folder/a<enter>//Delete folder under a file
# ls folder<enter>//confirm missing a file
# RM-RF folder<enter>//Delete folder

2, the creation and deletion of the Linux directory command
mkdir Create folder, DOS with
Usage: # mkdir [Options] folder name <Enter>
-p parents, parents. When the parent folder does not exist, create the parent folder first
# mkdir/tmp/haha<enter> ==> # file/tmp/haha<enter>
# mkdir-p/tmp/a/b/c/d<enter> ==> # file/tmp/a/b/c/d<enter>
# mkdir/tmp/{x,y,z}<enter>

rmdir Delete empty folders, DOS with
Usage: # rmdir [Options] folder name <Enter>
# Rmdir/tmp/a/b/c/d<enter>//Success
# rmdir/tmp/a/b<enter>//unsuccessful

CD Change directory, DOS with
Usage: # cd [Folder]<enter>
-//current directory and previous working directory switch
~//Household Directory
# CD-<enter> ==> # pwd<enter>
# CD ~<enter> ==> # pwd<enter>

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.