1.ls: Display directory file
-A : Show all files, including hidden files
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/88/23/wKioL1fqcSLzOaMcAABAPDUQi64011.png "title=" Image001.png "alt=" Wkiol1fqcslzoamcaabapduqi64011.png "/>
-A : Displays all files, including hidden files, but does not contain the current directory and parent directory
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/88/27/wKiom1fqcTjjtRmlAAA8IIRy_-I308.png "title=" Image002.png "alt=" Wkiom1fqctjjtrmlaaa8iiry_-i308.png "/>
- L : Lists Long data strings, including file properties, permissions, owner, owning group, size, and so on
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/88/23/wKioL1fqcWqRioqVAABRGdbHohY113.png "title=" Image003.png "alt=" Wkiol1fqcwqrioqvaabrgdbhohy113.png "/>
- D : Use with-l to view the directory's own properties (not a list of files inside the directory)
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/88/23/wKioL1fqcYCQ6opxAAAQZXZBRjM294.png "title=" Image004.png "alt=" Wkiol1fqcycq6opxaaaqzxzbrjm294.png "/>
2.CD : Switch Directories
CD/# switch to the root directory
CD (cd ~) #切换到当前用户的家目录
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/88/27/wKiom1fqcpmw4M3JAAAK_7Dq9XQ162.png "title=" Image005.png "alt=" Wkiom1fqcpmw4m3jaaak_7dq9xq162.png "/>
CD-# switch to the same directory you were in last time
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/88/23/wKioL1fqcqejzpMLAAALKeXA5kc798.png "title=" Image006.png "alt=" Wkiol1fqcqejzpmlaaalkexa5kc798.png "/>
CD: # switch to parent directory
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/88/23/wKioL1fqcrTD0cJrAAAOF6DKV5E206.png "title=" Image007.png "alt=" Wkiol1fqcrtd0cjraaaof6dkv5e206.png "/>
3.pwd : Displays the working directory where you are currently located
- P : Displays the actual physical address of the current directory
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/88/23/wKioL1fqcuOj2n1MAAAOys8cL_w730.png "title=" Image008.png "alt=" Wkiol1fqcuoj2n1maaaoys8cl_w730.png "/>
4.Touch : Create an empty file
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/88/27/wKiom1fqcvPj1MLOAABhJkUi2wg191.png "title=" Image009.png "alt=" Wkiom1fqcvpj1mloaabhjkui2wg191.png "/>
Added before the file name created. is to create a hidden file
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/88/23/wKioL1fqcwTSUi9bAABtToGQHo0031.png "title=" Image010.png "alt=" Wkiol1fqcwtsui9baabttogqho0031.png "/>
5.mkdir : Create a new directory
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/88/27/wKiom1fqcxnzs6e9AACie0hQ254924.png "title=" Image011.png "alt=" Wkiom1fqcxnzs6e9aacie0hq254924.png "/>
6.CP : Copy files/directories
Single source copy: Cp[option] ... [-T] SOURCE DEST
Multi-source replication: cp[option] ... SOURCE ... DIRECTORY
Cp[option] ...-t DIRECTORY SOURCE ...
In the case of single source replication, if Dest does not exist: The file is created beforehand and the data stream of the source file is copied to dest; if dest exists: (1) 0DEST is a non-directory file: overwrites the destination file ; (2) dest is a directory file: The Dest directory is the first to create a file with the same name as the source file, and copy its data stream, for multi-source replication, if the dest does not exist, the error is displayed, if the Dest exists: (1) dest is a non-directory file, the error is displayed ; (2) If dest is a directory file, copy each file to the target directory separately and keep the original
7.MV : Move files or rename files
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/88/23/wKioL1fqcy3xC1RMAAAH8RH6OuU130.png "title=" Image012.png "alt=" Wkiol1fqcy3xc1rmaaah8rh6ouu130.png "/>650" this.width=650; "src=" http://s2.51cto.com/wyfs02/ M02/88/27/wkiom1fqcz-bfqvuaaah8rh6ouu268.png "title=" Image012.png "alt=" Wkiom1fqcz-bfqvuaaah8rh6ouu268.png "/>
8.RM : Delete files/directories
- R : Recursive Delete
- F : Force Delete
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/88/23/wKioL1fqc07jNL3_AAAI-IfcLt4767.png "title=" Image013.png "alt=" Wkiol1fqc07jnl3_aaai-ifclt4767.png "/>
9.Cat : Show file Contents
- N : Show Line Numbers
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/88/27/wKiom1fqc2qx164YAAAwZixae08193.png "title=" Image014.png "alt=" Wkiom1fqc2qx164yaaawzixae08193.png "/>
Command execution status return value:
Bash : Outputs this result by a status return value
Success: 0
Failure: 1~255
Note: After the command execution is complete, its status return value is saved in Bash's special variable $? In the normal execution of commands, there will also be command return values, depending on the command and its function, the results are different;
Command line expansion:
~ : Automatically expands to the user home directory, or the specified user home directory;
{}: A comma-separated list of paths can be hosted and can be expanded to multiple paths;
Use the command line expansion feature to complete the following exercises:
created in/tmp directory:a_c,a_b,a_c,a_d
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/88/23/wKioL1fqc4HD_K5iAAAskIlVIdc760.png "title=" Image015.png "alt=" Wkiol1fqc4hd_k5iaaaskilvidc760.png "/>
Create the/tmp/mylinux directory:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/88/23/wKioL1fqc5fzg7PPAACvHsK3_GE038.png "title=" Image016.png "alt=" Wkiol1fqc5fzg7ppaacvhsk3_ge038.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/88/27/wKiom1fqc6ihLwvQAAAnRu2yCdE785.png "title=" Image017.png "alt=" Wkiom1fqc6ihlwvqaaanru2ycde785.png "/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/88/23/wKioL1fqc8fjHXKrAABG_H712nI900.png "title=" Image018.png "alt=" Wkiol1fqc8fjhxkraabg_h712ni900.png "/>
Data in any file system is divided into data and meta data:
Data: Refers to the actual data in a normal file
metadata: The system data used to describe the characteristics of a file, such as access rights, file owners, and the distribution of file data blocks, stored in the inode
You can use the command stat to see the metadata information of a file, including file name, size, access rights, block distribution information, access time, modification time, change time, etc.
use command touch to modify the timestamp of a file
Touch [ parameters] [file]
Touch-a: Just modify access time
Touch-c: Automatically created if the file does not exist
Touch-m: Modify Modify time only
Touch STAMP: Specify what time to change
Three time stamps
Access Time : Access time, abbreviated to Atime, read file contents
Modify Time: Modify the time, abbreviated to Mtime, change the file contents (data)
Change Time : Change Time, abbreviated to CTime, metadata changes
alias for command:alias
Alias: Displays all the available command aliases for the current shell process
Alias Name= " aliases "
Special reminder: Aliases defined on the command line, only for the current Shell process is in effect, if you want to make it permanent, write to the configuration file
for the current user only:~/.BASHRC
valid for all users:/ETC/BASHRC
The execution result of the reference command:
$ (command)
' Command '
Displays all files or directories in the/var directory that start with 1, end with a lowercase letter, and have at least one number (which can have other characters) in the middle.
Ls-d/var/l*[0-9]*[a-z]
Displays files or directories that start with any number in the/etc directory and end with a non-numeric
Ls-d/etc/[0-9]*[^0-9]
Displays a file or directory that starts with a non-letter, followed by a letter and any character of any length, in the/etc directory
Ls-d/etc/[^a-z][a-z]*
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-05-27-09-32-22
mkdir/tmp/tfile-' Date +%f-%h-%m-%s '
Copy all 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
Copy all files or directories ending with. D in the/etc directory into the/tmp/mytest2 directory
Cp-a/etc/*.d/tmp/mytest2
Copy all files in the/etc/directory that begin with L or M or N and end with. conf to the/TMP/MYTEST3 directory
Cp-a/etc/[l,m,n]*.conf/tmp/mytest3
Linux Basic file Management commands