[Job] 2016-08-14

Source: Internet
Author: User
Tags touch command

1. What are the file management commands on Linux, their commonly used methods and their related examples?

http://zhangke0516.blog.51cto.com/1655731/1835664

2. Bash's work characteristics the command execution status return value and command line expansion are involved in the content and its sample demonstration.

http://zhangke0516.blog.51cto.com/1655731/1836163

3. Use the command line expansion function to complete the following exercises:

(1), create/tmp directory: A_c, A_d, B_c, B_d

# touch/tmp/{a,b}_{c,d}

(2), create the/tmp/mylinux directory:

mylinux/

├──bin

├──boot

│└──grub

├──dev

├──etc

│├──rc.d

││└──init.d

│└──sysconfig

│└──network-scripts

├──lib

│└──modules

├──lib64

├──proc

├──sbin

├──sys

├──tmp

├──usr

│└──local

│├──bin

│└──sbin

└──var

├──lock

├──log

└──run


# mkdir-p/tmp/mylinux/{bin,boot/grub,dev,etc/rc.d/init.d,etc/sysconfig/network-scripts,lib/modules,lib64,proc, Sbin,sys,tmp,usr/local/{bin,sbin},var,lock,log,run}


4, what is the metadata information of the file, what does it mean, how to view it? How to modify timestamp information for a file.


Three time stamps:

Access time: Atime, reading the contents of a file

Modify Time: Modified, Mtime, change file contents (data)

Change time: Changing times, ctime, meta data changes


View file Status: Stat


Touch command:

Touch [OPTION] ... FILE ...

-a:only Atime

-m:only Mtime

-T STAMP:

[[Cc]yy] MMDDHHMM[.SS]

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


5, how to define the alias of a command, how to reference the execution result of another command in the command?


http://zhangke0516.blog.51cto.com/1655731/1836163


6. Display all files or directories in the/var directory that start with L, end with a lowercase letter, and have at least one digit (can have other characters) appear in the middle.


# ls-d/var/^l*[0-9]*[[:lower:]


7. Displays files or directories that start with any number in the/etc directory and end with a non-numeric number.


# ls-d/etc/[0-9]*[^0-9]


8, Show/etc directory, start with a non-letter, followed by a letter and any other arbitrary length of any character file or directory.


ls/etc/[^[:alpha:]][[:alpha:]]*


9. In the/tmp directory, create a file that starts with Tfile, followed by the current date and time, with a filename such as: tfile-2016-08-06-09-32-22.


# touch/tmp/tfile-$ (Date +%y-%m-%d-%h-%m-%s)


10. 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.


# cp-a/etc/p*[^0-9]/tmp/mytest1


11. Copy all files or directories ending with. D in the/etc directory into the/tmp/mytest2 directory.


# cp-a/etc/*.d/tmp/mytest2


12. Copy all files in the/etc/directory that begin with L or M or N and end with. conf to the/TMP/MYTEST3 directory.


# p-a/etc/[mn]*.conf/tmp/mmytest3


[Job] 2016-08-14

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.