linux创建文件及核对文件MD5

touch -amc filename

-a access
-m maintance
-c non-create
TOUCH(1)                                                                               User Commands                                                                              TOUCH(1)

NAME
       touch - change file timestamps

SYNOPSIS
       touch [OPTION]... FILE...

DESCRIPTION
       Update the access and modification times of each FILE to the current time.

       A FILE argument that does not exist is created empty, unless -c or -h is supplied.

       A FILE argument string of - is handled specially and causes touch to change the times of the file associated with standard output.

       Mandatory arguments to long options are mandatory for short options too.

       -a     change only the access time

       -c, --no-create
              do not create any files

       -d, --date=STRING
              parse STRING and use it instead of current time

       -f     (ignored)

       -h, --no-dereference
              affect each symbolic link instead of any referenced file (useful only on systems that can change the timestamps of a symlink)

       -m     change only the modification time

       -r, --reference=FILE
              use this file's times instead of current time

       -t STAMP
              use [[CC]YY]MMDDhhmm[.ss] instead of current time

       --time=WORD
              change the specified time: WORD is access, atime, or use: equivalent to -a WORD is modify or mtime: equivalent to -m

       --help display this help and exit

       --version
              output version information and exit

       Note that the -d and -t options accept different time-date formats.

       GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report touch translation bugs to <http://translationproject.org/team/>

DATE STRING
       The --date=STRING is a mostly free format human readable date string such as "Sun, 29 Feb 2004 16:21:42 -0800" or "2004-02-29 16:21:42" or even "next Thursday".  A date string may
       contain items indicating calendar date, time of day, time zone, day of week, relative time, relative date, and numbers.  An empty string indicates the beginning of the  day.   The
       date string format is more complex than is easily documented here but is fully described in the info documentation.

AUTHOR
       Written by Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, and Randy Smith.

COPYRIGHT
       Copyright © 2013 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
       This is free software: you are free to change and redistribute it.  There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
       The full documentation for touch is maintained as a Texinfo manual.  If the info and touch programs are properly installed at your site, the command

stat
查看文件状态

STAT(1)                                                                                User Commands                                                                               STAT(1)

NAME
       stat - display file or file system status

SYNOPSIS
       stat [OPTION]... FILE...

DESCRIPTION
       Display file or file system status.

       Mandatory arguments to long options are mandatory for short options too.

       -L, --dereference
              follow links

       -f, --file-system
              display file system status instead of file status

       -c  --format=FORMAT
              use the specified FORMAT instead of the default; output a newline after each use of FORMAT

       --printf=FORMAT
              like --format, but interpret backslash escapes, and do not output a mandatory trailing newline; if you want a newline, include \n in FORMAT

       -t, --terse
              print the information in terse form

       --help display this help and exit

       --version
              output version information and exit

du

NAME
       du - estimate file space usage

SYNOPSIS
       du [OPTION]... [FILE]...
       du [OPTION]... --files0-from=F

DESCRIPTION
       Summarize disk usage of each FILE, recursively for directories.

       Mandatory arguments to long options are mandatory for short options too.

       -0, --null
              end each output line with 0 byte rather than newline

       -a, --all
              write counts for all files, not just directories

       --apparent-size
              print  apparent  sizes,  rather  than  disk usage; although the apparent size is usually smaller, it may be larger due to holes in ('sparse') files, internal fragmentation,
              indirect blocks, and the like

       -B, --block-size=SIZE
              scale sizes by SIZE before printing them; e.g., '-BM' prints sizes in units of 1,048,576 bytes; see SIZE format below

       -b, --bytes
              equivalent to '--apparent-size --block-size=1'

       -c, --total
              produce a grand total

       -D, --dereference-args
              dereference only symlinks that are listed on the command line

       -d, --max-depth=N
              print the total for a directory (or file, with --all) only if it is N or fewer levels below the command line argument;  --max-depth=0 is the same as --summarize

       --files0-from=F
              summarize disk usage of the NUL-terminated file names specified in file F; if F is -, then read names from standard input

       -H     equivalent to --dereference-args (-D)

       -h, --human-readable
              print sizes in human readable format (e.g., 1K 234M 2G)

       --inodes
              list inode usage information instead of block usage

       -k     like --block-size=1K

       -L, --dereference
              dereference all symbolic links

       -l, --count-links
              count sizes many times if hard linked

       -m     like --block-size=1M

       -P, --no-dereference
              don't follow any symbolic links (this is the default)

       -S, --separate-dirs
              for directories do not include size of subdirectories

       --si   like -h, but use powers of 1000 not 1024

       -s, --summarize
              display only a total for each argument

       -t, --threshold=SIZE
              exclude entries smaller than SIZE if positive, or entries greater than SIZE if negative

       --time show time of the last modification of any file in the directory, or any of its subdirectories

       --time=WORD
              show time as WORD instead of modification time: atime, access, use, ctime or status

       --time-style=STYLE
              show times using STYLE, which can be: full-iso, long-iso, iso, or +FORMAT; FORMAT is interpreted like in 'date'

       -X, --exclude-from=FILE
              exclude files that match any pattern in FILE

       --exclude=PATTERN
              exclude files that match PATTERN

       -x, --one-file-system
              skip directories on different file systems

       --help display this help and exit

       --version
              output version information and exit

md5sum

NAME
       md5sum - compute and check MD5 message digest

SYNOPSIS
       md5sum [OPTION]... [FILE]...

DESCRIPTION
       Print or check MD5 (128-bit) checksums.  With no FILE, or when FILE is -, read standard input.

       -b, --binary
              read in binary mode

       -c, --check
              read MD5 sums from the FILEs and check them

       --tag  create a BSD-style checksum

       -t, --text
              read in text mode (default)

              Note: There is no difference between binary and text mode option on GNU system.

**

For example:

**

[root@localhost tmp]# touch -c test.txt
[root@localhost tmp]# ls
ks-script-G5vxQG  yum.log  yum_save_tx.2020-02-01.20-59.E1jayN.yumtx
[root@localhost tmp]# touch -a test.txt
[root@localhost tmp]# ls
ks-script-G5vxQG  test.txt  yum.log  yum_save_tx.2020-02-01.20-59.E1jayN.yumtx


[root@localhost tmp]# stat test.txt 
  File: ‘test.txt’
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d	Inode: 8389155     Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:user_tmp_t:s0
Access: 2020-02-02 01:45:27.837000000 +0800
Modify: 2020-02-02 01:45:27.837000000 +0800
Change: 2020-02-02 01:45:27.837000000 +0800
 Birth: -
[root@localhost tmp]# touch -a test.txt
[root@localhost tmp]# ls -l
total 32
-rwx------. 1 root root   836 Feb  1 18:06 ks-script-G5vxQG
-rw-r--r--. 1 root root     0 Feb  2 01:45 test.txt
-rw-------. 1 root root     0 Feb  1 18:00 yum.log
-rw-------. 1 root root 26959 Feb  1 20:59 yum_save_tx.2020-02-01.20-59.E1jayN.yumtx
[root@localhost tmp]# stat test.txt
  File: ‘test.txt’
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d	Inode: 8389155     Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:user_tmp_t:s0
Access: 2020-02-02 01:46:12.980000000 +0800
Modify: 2020-02-02 01:45:27.837000000 +0800
Change: 2020-02-02 01:46:12.980000000 +0800
 Birth: -
[root@localhost tmp]# touch -m test.txt
[root@localhost tmp]# stat test.txt
  File: ‘test.txt’
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d	Inode: 8389155     Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:user_tmp_t:s0
Access: 2020-02-02 01:46:12.980000000 +0800
Modify: 2020-02-02 01:46:55.167000000 +0800
Change: 2020-02-02 01:46:55.167000000 +0800
 Birth: -
[root@localhost src]# du -h vim-8.2.0100.tar.gz 
12M	vim-8.2.0100.tar.gz
[root@localhost src]# du -k vim-8.2.0100.tar.gz 
11292	vim-8.2.0100.tar.gz
[root@localhost src]# du -b vim-8.2.0100.tar.gz 
11560112	vim-8.2.0100.tar.gz
[root@localhost src]# du  vim-8.2.0100.tar.gz 
11292	vim-8.2.0100.tar.gz
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值