Linux基础-文件管理命令

文件管理命令:

  1. touch: 创建或更新文件时间
    创建文件
    [root@bogon ssx-linux]# touch file{1..6}
    [root@bogon ssx-linux]# ls
    a b c d e file1 file2 file3 file4 file5 file6
    [root@bogon ssx-linux]# touch file{a,b,c}
    [root@bogon ssx-linux]# ls
    a b c d e file1 file2 file3 file4 file5 file6 filea fileb filec
    [root@bogon ssx-linux]# rm -f file{a..c}
    [root@bogon ssx-linux]# ls
    a b c d e file1 file2 file3 file4 file5 file6
    [root@bogon ssx-linux]# touch file{a..z}
    [root@bogon ssx-linux]# ls
    a c e file2 file4 file6 fileb filed filef fileh filej filel filen filep filer filet filev filex filez
    b d file1 file3 file5 filea filec filee fileg filei filek filem fileo fileq files fileu filew filey
    [root@bogon ssx-linux]#

        ***更新文件时间***

    [root@bogon ssx-linux]# ll
    total 0
    drwxr-xr-x 3 root root 15 Feb 1 06:41 a
    drwxr-xr-x 2 root root 6 Feb 1 06:41 b
    drwxr-xr-x 2 root root 6 Feb 1 06:41 c
    drwxr-xr-x 2 root root 6 Feb 1 06:41 d
    drwxr-xr-x 2 root root 6 Feb 1 06:41 e
    -rw-r--r-- 1 root root 0 Feb 1 07:08 file1
    -rw-r--r-- 1 root root 0 Feb 1 07:08 file2
    -rw-r--r-- 1 root root 0 Feb 1 07:08 file3
    -rw-r--r-- 1 root root 0 Feb 1 07:08 file4
    -rw-r--r-- 1 root root 0 Feb 1 07:08 file5
    -rw-r--r-- 1 root root 0 Feb 1 07:08 file6
    [root@bogon ssx-linux]# touch file{1..6}
    [root@bogon ssx-linux]# ll
    total 0
    drwxr-xr-x 3 root root 15 Feb 1 06:41 a
    drwxr-xr-x 2 root root 6 Feb 1 06:41 b
    drwxr-xr-x 2 root root 6 Feb 1 06:41 c
    drwxr-xr-x 2 root root 6 Feb 1 06:41 d
    drwxr-xr-x 2 root root 6 Feb 1 06:41 e
    -rw-r--r-- 1 root root 0 Feb 1 07:12 file1
    -rw-r--r-- 1 root root 0 Feb 1 07:12 file2
    -rw-r--r-- 1 root root 0 Feb 1 07:12 file3
    -rw-r--r-- 1 root root 0 Feb 1 07:12 file4
    -rw-r--r-- 1 root root 0 Feb 1 07:12 file5
    -rw-r--r-- 1 root root 0 Feb 1 07:12 file6
    [root@bogon ssx-linux]#

  2. stat
    [root@bogon ssx-linux]# stat file6
    File: ‘file6’
    Size: 0 Blocks: 0 IO Block: 4096 regular empty file
    Device: fd00h/64768d Inode: 18796551 Links: 1
    Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
    Access: 2019-02-01 07:12:12.448044258 +0800
    Modify: 2019-02-01 07:12:12.448044258 +0800
    Change: 2019-02-01 07:12:12.448044258 +0800
    Birth: -
    [root@bogon ssx-linux]# vi file6
    [root@bogon ssx-linux]# stat file6
    File: ‘file6’
    Size: 6 Blocks: 8 IO Block: 4096 regular file
    Device: fd00h/64768d Inode: 18796553 Links: 1
    Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
    Access: 2019-02-01 07:15:25.168046803 +0800
    Modify: 2019-02-01 07:15:25.168046803 +0800
    Change: 2019-02-01 07:15:25.173046803 +0800
    Birth: -
    [root@bogon ssx-linux]#

  3. lrzsz
    --yum install -y lrzsz

--上传
rz -E
--回车后选择需要上传的文件
sz test.txt
--回车后选择需要存储下载文件的位置

4.file查看文件类型
[root@wll ~]# file file
file: cannot open (No such file or directory)
[root@wll ~]# file file1
file1: empty
[root@wll ~]# echo "123" > file2
[root@wll ~]# file file2
file2: ASCII text
[root@wll ~]#

上一篇:贪心专题练习


下一篇:java基础