Linux Common Commands | Catalog files

Source: Internet
Author: User

directory file-related Linux commands 1. Create a new folder:mkdir Path/New folder name: 2. Delete the directory:RM-RF Path/folder name to be deleted (/* empty folder)
                 -r 就是向下递归,不管有多少级目录,一并删除                 -f 就是直接强行删除,不作任何提示的意思                 -v 详细:显示文件的删除进度

RmDir

3. Copy the directory:CP-RF a path (* * All folders and files under the/* directory) b Path 4. Directory rename (cut):MV source file name destination file name
                    -i  互动:如果选择的文件会覆盖目标中的文件,他会提示确认                    -f  强制:它会超越互动模式,不提示地移动文件,属于很危险的选项                    -v  详细:显示文件的移动进度
5. Create a file:Touch Path/File name
            eg: touch A{1..100} 创建 A1,A2,A3 .. A100
6. Jump to a directory:CD directory path
                eg:cd /      转到根目录中                     cd ~     转到/home/user用户目录下                     cd /usr 转到根目录下的usr目录中-------------绝对路径                     cd test 转到当前目录下的test子目录中-------相对路径
7. View the contents of the catalog:Ls
                eg:-a   列举目录中的全部文件,包括隐藏文件                    -l  列举目录中的细节,包括权限、所有者、组群、大小、创建日期、文件是否是链接等                    -f  列举的文件显示文件类型                    -r  逆向,从后向前地列举目录中内容                    -R  递归,该选项递归地列举当前目录下所有子目录内的内容                    -s  大小,按文件大小排序                    -h  以人类可读的方式显示文件的大小,如用K、M、G作单位                    ls -l examples.doc  列举文件examples.doc的所有信息
8. View the current path:PWD (print working directory) 9. Find the string:Grep
                eg:grep girl hello.txt 在hello文件中找girl这个字符串
10. Find Files:find [path] [parameter]
参数说明:        1. 时间:           -atimen    :在 n*24小时内被 access 即存取过的文件列出来!           -ctime n    :在 n*24小时内被 changed 即改变、新增的文件或目录印出           -mtimen    :在 n*24小时内被 modified 即修改过的文件印出          -newer file :比 file 还要新的文件就列出来!        2. 使用名称:           -gidn     :寻找 群组 ID 为 n 的文件           -group name :寻找群组名称为 name的文件           -uidn     :寻找拥有者 ID 为 n 的文件           -user name :寻找使用者名称为 name 的文件           -name file :寻找档名为 file 的文件名称(可以使用万用字符)           -type type :寻找档案属性为 type 的档案,type 包含了 b, c, d, p, l, s,这些与前一章的属性相同!例如 l 为 Link而 d 为路径之意!

eg

find . -name hello1            //在当前目录下查找名为 hello1 的文件find . -name ‘hello*‘          //在当前目录下查找名为hellow开头的文件find ./ -user root             //在当前目录下查找user为root拥有的文件find ./ -ctime 1               //在当前目录下查找一天内新增的文件

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Linux Common Commands | Catalog files

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.