TOUNCH

touch

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.
       不存在的文件參數被創建爲空,除非提供-c或-h。

在這裏插入圖片描述
stat 命令可以產看文件的訪問時間 修改時間 改變時間
注:

  • access 表示最後一次訪問(僅僅是訪問,沒有改動)文件的時間

  • modify 表示最後一次修改文件的時間

  • change 表示最後一次對文件屬性改變的時間,包括權限,大小,屬性等等

       A FILE argument string of - is handled specially and causes touch to change the times of the file associated with standard output.
       文件參數字符串的-被特別處理,並導致touch更改與標準輸出相關聯的文件的時間。
    

不存在的文件不會創建 -c

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

改變文件的訪問時間 -a

   -a     change only the access time

在這裏插入圖片描述
兩種方式 一種是直接訪問文件,另一種是通過 -a命令

修改文件的修改時間 -m

   -m     change only the modification time 指修改Modify(修改)時間,而不修改access(訪問)時間

在這裏插入圖片描述

用指定文件的時間替換當前時間 -r

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

在這裏插入圖片描述

將時間stamp修改爲參數指定的日期 -t

   -t STAMP
          use [[CC]YY]MMDDhhmm[.ss] instead of current time 
          將時間修改爲參數指定的日期,如:07081556代表7月8號15點56分

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

在這裏插入圖片描述

將時間string修改爲參數指定的日期(常用) -d

   -d, --date=STRING
          parse STRING and use it instead of current time
          
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.
       date=STRING是一種基本免費的人類可讀日期字符串格式,比如“Sun, Feb 29 2004 16:21:42 -0800”或“2004-02-29 16:21:42”,甚至“next Thursday”。日期字符串可以包含指示日曆日期、時間的項
       日、時區、星期、相對時間、相對日期和數字。空字符串表示一天的開始。

在這裏插入圖片描述

mkdir

   mkdir - make directories 創建目錄

SYNOPSIS
       mkdir [OPTION]... DIRECTORY...
       目錄:指定要創建的目錄列表,多個目錄之間用空格隔開。

DESCRIPTION
       Create the DIRECTORY(ies), if they do not already exist.
       創建目錄(ies),如果它們還不存在的話。

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

創建目錄

在這裏插入圖片描述

建立目錄的同時設置目錄的權限

   -m, --mode=MODE 
          set file mode (as in chmod), not a=rwx - umask

在這裏插入圖片描述

建立多級目錄

   -p, --parents
          no error if existing, make parent directories as needed
          若所要建立目錄的上層目錄目前尚未建立,則會一併建立上層目錄

在這裏插入圖片描述

rm

NAME
       rm - remove files or directories
       刪除文件或目錄

SYNOPSIS
       rm [OPTION]... [FILE]...

默認不刪除目錄

       This manual page documents the GNU version of rm.  rm removes each specified file.  By default, it does not remove directories.
       rm刪除每個指定的文件。默認情況下,它不會刪除目錄。

   If  the  -I  or --interactive=once option is given, and there are more than three files or the -r, -R, or --recursive are given, then rm prompts the user for whether to proceed with the entire operation.  If the response is not
   affirmative, the entire command is aborted.
   如果給出了-I或 --interactive=once 選項,並且有三個以上的文件,或者 給出了-r、-R或--recursive,那麼rm會提示用戶是否繼續執行整個操作。如果響應不是肯定的,則整個命令將中止。

   Otherwise, if a file is unwritable, standard input is a terminal, and the -f or --force option is not given, or the -i or --interactive=always option is given, rm prompts the user  for  whether  to  remove  the  file.   If  the
   response is not affirmative, the file is skipped.
   否則,如果一個文件是不可寫的,標準輸入就是一個終端,並且沒有提供-f或——force選項,或者提供-i或--interactive=always選項,rm會提示用戶是否刪除該文件。如果響應不是肯定的,則跳過該文件。

OPTIONS
       Remove (unlink) the FILE(s). 
       刪除(取消鏈接)文件。

刪除時不提示

   -f, --force
          ignore nonexistent files and arguments, never prompt
          忽略不存在的文件和參數,永遠不要提示

刪除時提示

   -i     prompt before every removal
          每次刪除前提示

   -I     prompt once before removing more than three files, or when removing recursively; less intrusive than -i, while still giving protection against most mistakes
          刪除三個以上文件前或遞歸刪除時提示一次;比-i更少的侵入性,同時仍然提供了對大多數錯誤的保護

   --interactive[=WHEN]
          prompt according to WHEN: never, once (-I), or always (-i); without WHEN, prompt always
          根據時間提示:never、once (-I)或always (-I); 沒有時間,總是提示

   --one-file-system
          when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument

   --no-preserve-root
          do not treat '/' specially
          不特別對待'/'

   --preserve-root
          do not remove '/' (default)
          不要刪除'/'(默認值)

遞歸刪除目錄及其內容

   -r, -R, --recursive
          remove directories and their contents recursively
          遞歸地刪除目錄及其內容

刪除空目錄

   -d, --dir
          remove empty directories
          刪除空目錄

   By default, rm does not remove directories.  Use the --recursive (-r or -R) option to remove each listed directory, too, along with all of its contents.
   默認情況下,rm不刪除目錄。還可以使用--recursive (-r或-r)選項刪除列出的每個目錄及其所有內容。

   To remove a file whose name starts with a '-', for example '-foo', use one of these commands:
   要刪除名稱以“-”開頭的文件,例如“-foo”,請使用以下命令之一:
          rm -- -foo
          rm ./-foo

   Note that if you use rm to remove a file, it might be possible to recover some of its contents, given sufficient expertise and/or time.  For greater assurance that the contents are truly unrecoverable, consider using shred.
   請注意,如果您使用rm刪除文件,那麼只要有足夠的專業知識和/或時間,就有可能恢復其中的一些內容。爲了更好地確保內容確實不可恢復,可以考慮使用shred。

shred

SHRED(1) User Commands SHRED(1)

NAME
shred - overwrite a file to hide its contents, and optionally delete it
覆蓋文件以隱藏其內容,並選擇性地刪除它

SYNOPSIS
shred [OPTION]… FILE…

DESCRIPTION
Overwrite the specified FILE(s) repeatedly, in order to make it harder for even very expensive hardware probing to recover the data.
重複覆蓋指定的文件,以便使即使非常昂貴的硬件探測也難以恢復數據。

   If FILE is -, shred standard output.
   如果文件是-,撕碎標準輸出。

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

   -f, --force
          change permissions to allow writing if necessary
          如果需要,更改權限以允許寫入

   -n, --iterations=N
          overwrite N times instead of the default (3)
          覆蓋N次而不是默認值(3)

   --random-source=FILE
          get random bytes from FILE
          從文件中獲取隨機字節

   -s, --size=N
          shred this many bytes (suffixes like K, M, G accepted)
          分解這麼多字節(接受K、M、G等後綴)

   -u     truncate and remove file after overwriting
          覆蓋後截斷並刪除文件

   --remove[=HOW]
          like -u but give control on HOW to delete;  See below
          比如-u,但要控制如何刪除;見下文

   -v, --verbose
          show progress
          顯示進度

   -x, --exact
          do not round file sizes up to the next full block;
          不要將文件大小四捨五入到下一個完整塊;

          this is the default for non-regular files
          這是非常規文件的默認設置

   -z, --zero
          add a final overwrite with zeros to hide shredding
          添加帶有零的最終覆蓋,以隱藏分解

   Delete  FILE(s)  if  --remove  (-u) is specified.  The default is not to remove the files because it is common to operate on device files like /dev/hda, and those files usually should not be removed.  The optional HOW parameter
   indicates how to remove a directory entry: 'unlink' => use a standard unlink call.  'wipe' => also first obfuscate bytes in the name.  'wipesync' => also sync each obfuscated byte to disk.  The default mode is  'wipesync',  but
   note it can be expensive.
   如果指定了remove (-u),則刪除文件。默認情況下不刪除這些文件,因爲對/dev/hda這樣的設備文件進行操作是很常見的,而且通常不應該刪除這些文件。可選HOW參數指示如何刪除目錄項:'unlink' =>使用標準的unlink調用。'wipe' =>也首先混淆了名稱中的字節。'wipesync' =>還將每個混淆的字節同步到磁盤。默認模式是'wipesync',但注意它可能很昂貴。

   CAUTION:  Note that shred relies on a very important assumption: that the file system overwrites data in place.  This is the traditional way to do things, but many modern file system designs do not satisfy this assumption.  The
   following are examples of file systems on which shred is not effective, or is not guaranteed to be effective in all file system modes:
   注意:注意shred依賴於一個非常重要的假設:文件系統會覆蓋現有的數據。這是傳統的方法,但是許多現代文件系統設計並不滿足這種假設。以下是shred在所有文件系統模式下無效或不能保證有效的文件系統示例:
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章