Touch, CP, alias, mkdir command detailed

Source: Internet
Author: User

Touch command: Touch [OPTION] ... FILE ...


-A: Change atime only

-M: Change Mtime only

-C: If the file does not exist, it is not created

-T: Specify when the file was created


Little Practice


Create files with the same day as the file name;

Touch ' Date +%f ' or another Touch $ (date+%f)

CP command


-I: Interactive

-R,-r: recursively copy directories and all internal content;

-A: Archive, equivalent to-DR--preserv=all

--preserv[=attr_list]

Mode: Permissions

Ownership: Belong to the main group

Timestamp

Links

Xattr

Context

All


Little Practice

1, the/etc/directory of all files, backup to/testdir/under the new directory, and require the new directory format is BACKUPYYYY-MM-DD, the backup process is visible

2, first create the/testdir/rootdir directory, and then copy the/root all the next file into the directory, and ask to retain the original permissions

For:

1. Cp-av/etc/testdir/backup ' Date +%f ' 2. CP--preserv=mode/root/*/testdir/rootdir


Alias Command aliases


Usage alias name= ' VALUE '

Aliases defined on the command line, valid only for the current shell process if you want to be permanently valid, define in the configuration file

For the current user only: ~/.BASHRC

Valid for all users:/ETC/BASHRC

The new configuration given by the edit configuration does not take effect immediately; The bash process re-reads the configuration file:

Source/path/to/config_file or

./path/to/config_file


mkdir Creating a Directory


-P: exists in no error, and can automatically create the required directories;

-V: Show more information

-M MODE: Specify permissions directly when creating a directory;


Little Practice

(1) How to create/testdir/dir1/x,/testdir/dir1/y,/testdir/dir1/x/a,/testdir/dir1/x/b,/testdir/dir1/y/a,/testdir/dir1/y/b

(2) How to create/testdir/dir2/x,/testdir/dir2/y,/testdir/dir2/x/a,/testdir/dir2/x/b

(3) How to create/TESTDIR/DIR3,/TESTDIR/DIR4,/TESTDIR/DIR5,/TESTDIR/DIR5/DIR6,/TESTDIR/DIR5/DIR7


For

(1) MKDIR-PV testdir/dir1/{x,y} Testdir/dir1/x/{a,b} Testdir/dir1/y/{a,b} (2) Mkdir-pv/testdir/dir2/{x,y}/testdir/ DIR2/X/{A,B} (3) MKDIR-PV testdir/dir{3,4,5} testdir/dir5/dir{3,4}


This article is from the "11192821" blog, please be sure to keep this source http://11202821.blog.51cto.com/11192821/1831574

Touch, CP, alias, mkdir command detailed

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.