/var,/etc,/tmp Directory operation under Linux

Source: Internet
Author: User

Displays all files or directories in the/var/directory that start with 1, end with a lowercase letter, and have at least one digit in the middle (which can have other characters).
Command:
Ls-d/var/1*[0-9]*[a-z]

Displays files or directories that start with any number in the/etc directory and end with a non-numeric number.
Command:
ls-d/etc/[[:d igit:]]*[[1]]

Displays the/etc directory, not the beginning of the letter, followed by a letter and any other length of any character file or directory.
Command:
ls-d/etc/[[2]][[:alpha:]]*

In the/tem directory, create a file that begins with Tfile, followed by the current date and time, with a filename such as: tfile-2016-05-27-09-32-22.
Command:
touch/tmptfile-' date+%y-%m-%d-%h-%m-%s '

Copy all the files or directories in the/etc directory to the/tmp/mytest1 directory that begin with P and do not end with a number.
Command:
Mkdir/tmp/mytest1 (now create the Mytest1 directory in the/tmp directory)
Cp-r/etc/p*[[3]]/tmp/mytest1

Copy all files or directories ending with. D in the/etc directory into the/tmp/mytest2 directory.
Command:
Mkdir/tmp/mytest2
Cp-r/etc/*.d/tmp/mytest2

Copy all files that end with. conf to the/TMP/MYTEST3 directory in the/etc/directory, starting with 1 or M or N.
Command:
Mkdir/tem/mytest3
Cp-r/etc/[1,m,n,]*.conf/tmp/mytest3

    1. :d igit:?

    2. : Alpha:?

    3. :d igit:?

/var,/etc,/tmp Directory operation under Linux

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.