Linux-text-3

Source: Internet
Author: User
Tags aliases touch command

Bash's variable types are mainly: local variables, local variables, environment variables, positional variables, and special variables, where the $ in special variables? This variable is changing at any time, where the saved data is the execution state return value of the command that was just executed

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/89/BB/wKioL1gbGU6xYUPWAAAwg1V2xJk234.png-wh_500x0-wm_3 -wmp_4-s_242634860.png "title=" 1.png "alt=" Wkiol1gbgu6xyupwaaawg1v2xjk234.png-wh_50 "/>

Execution status return value $? The number means:


0: Successful execution;


1-255: Execution failed



Use the command line expansion feature to complete the following exercises:


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

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/89/BB/wKioL1gbGiDhn-4XAAAgUbuzqlk377.png-wh_500x0-wm_3 -wmp_4-s_966605570.png "title=" 1.png "alt=" Wkiol1gbgidhn-4xaaagubuzqlk377.png-wh_50 "/>


(2), create/tmp/mylinux directory

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/89/BB/wKioL1gbG0nwfPXzAACN3t3mI9Q890.png-wh_500x0-wm_3 -wmp_4-s_745704706.png "title=" 1.png "alt=" Wkiol1gbg0nwfpxzaacn3t3mi9q890.png-wh_50 "/>

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/89/BB/wKioL1gbHRvAn7trAABlbABm3Pg011.png-wh_500x0-wm_3 -wmp_4-s_1089647229.png "title=" 1.png "alt=" Wkiol1gbhrvan7traablbabm3pg011.png-wh_50 "/>



(3), what is the metadata information of a file, what does it mean, and how to view it? How to modify timestamp information for a file

Time Stamp management tool for files:


Touch


File: metadata, data


View file Status: Stat


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


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


(4), how to define the alias of a command, how to reference the execution result of another command in the command?

Command Aliases (alias)


Implemented by the alias command:


(1) Alias


Displays all the available command aliases for the current shell process;


(2) Alias Name= ' VALUE '


Defines the alias name, which is equivalent to executing the command value;


Note: Aliases defined on the command line are valid only for the current shell process, and are defined in the configuration file if you want to be permanently valid;


For the current user only: ~/.BASHRC


Valid for all users:/ETC/BASHRC


Note: The new configuration given by the edit configuration will not take effect immediately;


The bash process re-reads the configuration file:


Source/path/to/config_file


. /path/to/config_file


Undo Alias: Unalias


Unalias [-A] name [name ...]


Note: If the alias is the same as the name of the original command, you can use "\command" if you want to execute the original command;


Reference the execution result of another command-pipeline:


COMMAND1 | COMMAND2 | COMMAND3 |


Note: The last command executes in the child shell process of the current shell process;


(5), displays all the 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) in the middle

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/89/BB/wKioL1gbHwKSEGvTAAAfbW8D7wc941.png-wh_500x0-wm_3 -wmp_4-s_4176413366.png "title=" 1.png "alt=" Wkiol1gbhwksegvtaaafbw8d7wc941.png-wh_50 "/>


(6), display a file or directory that starts with any number in the/etc directory and ends in a non-numeric

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/89/BB/wKioL1gbH3OyCb8aAAAesOUcUxo630.png-wh_500x0-wm_3 -wmp_4-s_1395204721.png "title=" 1.png "alt=" Wkiol1gbh3oycb8aaaaesoucuxo630.png-wh_50 "/>


(7), display the/etc directory, start with a non-letter, followed by a letter and any other length of any character file or directory

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/89/BE/wKiom1gbH_eBgpf8AAAf1R3A_Ok568.png-wh_500x0-wm_3 -wmp_4-s_538577421.png "title=" 1.png "alt=" Wkiom1gbh_ebgpf8aaaf1r3a_ok568.png-wh_50 "/>


(8), in the/testdir directory to create a tfile beginning, followed by the current date and time of the file, the file name is as follows: Tfile-2016-05-27-09-32-22

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/89/BC/wKioL1gbIZ_gqpotAAAsFNRxNuE668.png-wh_500x0-wm_3 -wmp_4-s_3968729638.png "title=" 1.png "alt=" Wkiol1gbiz_gqpotaaasfnrxnue668.png-wh_50 "/>

(9), copy all the files or directories in the/etc directory to the/testdir/list02 directory that begin with P and do not end with a number

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/89/BC/wKioL1gbI5Wg26PuAABKdEoXSz0097.png-wh_500x0-wm_3 -wmp_4-s_779231817.png "title=" 1.png "alt=" Wkiol1gbi5wg26puaabkdeoxsz0097.png-wh_50 "/>


(10), copy all files or directories ending with. d in/etc directory to the/testdir/list01 directory

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/89/BE/wKiom1gbIvaTF9fCAAA2pEUilv0255.png-wh_500x0-wm_3 -wmp_4-s_158491046.png "title=" 1.png "alt=" Wkiom1gbivatf9fcaaa2peuilv0255.png-wh_50 "/>


(11), copy all files in the/etc/directory starting with L or M or N and ending with. conf to the/testdir/list03 directory

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/89/BE/wKiom1gbJDuQkPMiAAAXRAezLmw336.png-wh_500x0-wm_3 -wmp_4-s_1670099791.png "title=" 1.png "alt=" Wkiom1gbjduqkpmiaaaxraezlmw336.png-wh_50 "/>

Linux-text-3

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.