File System management under Linux

Source: Internet
Author: User
Tags touch command

File System management under Linux

What are the file management commands for Linux, common use methods and case columns


LS usage:

ls [options] [file]

"Instance 1"

If the LS command is not followed by the target (file or directory), view the contents of the current directory, if you want to view the specified directory or file, after the LS command followed the path of the target file or directory

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/88/04/wKiom1fnjf-DEnpBAAAWs_PJEck188.png "title=" Untitled picture. png "alt=" Wkiom1fnjf-denpbaaaws_pjeck188.png "/>

the instance 2 "

View all files in the directory (including . the beginning of the file or directory)     ----  Use -A Options

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/88/00/wKioL1fnjn6j212fAAAkzLN453o383.png "title=" Untitled picture. png "alt=" Wkiol1fnjn6j212faaakzln453o383.png "/>

Note. Represents the current directory

.. Represents a parent directory or an ancestor directory

"Instance 3"

View all files in the directory (recursive view, directories and files in the directory can be found)

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/88/00/wKioL1fnjxbjoOMcAAAqqKz9wGY787.png "title=" Untitled picture. png "alt=" Wkiol1fnjxbjoomcaaaqqkz9wgy787.png "/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/88/04/wKiom1fnj5Wj6tcsAABRScJhhDA279.png "title=" QQ picture 20160924164810.png "alt=" Wkiom1fnj5wj6tcsaabrscjhhda279.png "/>


Mkdir

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/88/01/wKioL1fnkOvgPHhxAAAoE2zEhPQ778.png "title=" QQ picture 20160924165220.png "alt=" Wkiol1fnkovgphhxaaaoe2zehpq778.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/88/04/wKiom1fnkWvjWMCiAAArGbIxnBo586.png "title=" QQ picture 20160924165509.png "alt=" Wkiom1fnkwvjwmciaaargbixnbo586.png "/>


RmDir "Instance 1" deletes an empty directory--and if the parent directory of this directory is also empty, remove the parent directory page----Use the-p option

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/88/01/wKioL1fnkfDRq9Y0AADQfvYAcSQ183.png "title=" Untitled picture. png "alt=" Wkiol1fnkfdrq9y0aadqfvyacsq183.png "/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/88/04/wKiom1fnkjijq8UgAABb0VO84V8442.png "title=" QQ picture 20160924165933.png "alt=" Wkiom1fnkjijq8ugaabb0vo84v8442.png "/>




650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/88/04/wKiom1fnkqaCBDDXAAAkcX0K_Lc336.png "title=" QQ picture 20160924170124.png "alt=" Wkiom1fnkqacbddxaaakcx0k_lc336.png "/>

MV---- equivalent Windows cut in the

when moving a file, if the target file exists, back up the target file before moving, using-- b Options





There are two types of command execution results for BASH: success and failure. Bash uses special variable $? To save the results of the most recent command, 0 for success, 1-255 for a different failure, 1 for failure, 2 for failure, but not the same for both failures. Bash command-line expansion: {} means that you can host a list that is well-partitioned and expand it to multiple paths.

such as:/tmp/{a,b}=/tmp/a,/tmp/b/tmp/{a.b}=/tmp/a/c/,/tmp/b/c



Create a a_c,a_d,b_c,b_d under the/tmp directory

     mkdir/tmp/a_c    mkdir/tmp/a_d     mkdir/tmp/b_c     mkdir/tmp/b_d

cd/tmp mkdir a_c a_d b_c b_d

Create the/tmp/myliunx directory under the

myliunx/

├──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


Metadata for a file

The metadata contains information such as the permissions, size, owner, owning group, and modification time of the file, which can be viewed with the ls-l command. Use the touch command to modify the timestamp information.

Define an alias for a command, how do I refer to the execution result of another command in a command?

Use alias to define an individual name, alias aliasname = Command + option

Use a pipe to refer to another command to perform the results, such as Ps-ef |grep httpd


Displays 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/var/l*[[:d Igit:]]*[[:lower:]]


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

ls/etc/[[:d igit:]]*[^[:d igit:]]


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/etc/[^[:alpha:]][[:alpha:]]*


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

Touch tfile-' 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.

cp/etc/p*[^[:d igit:]]/tmp/mytest1/


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

Cp-r/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/etc/[lmn]*.conf/tmp/mytest3/



















This article from the "12067732" blog, reproduced please contact the author!

File System management 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.