Тач файл. Touch Программки и утилиты

With no options, touch will change the atime, mtime, and ctime of file to the current system time.

Options

Option Description
-a Set the access time only.
-c ,
--no-create
Do not create files.
-d datestring ,
--date= datestring
Parse the date string datestring , and use it instead of current time. Strings valid to the date command are accepted by the -d option.
-f This option does nothing, but is accepted to provide compatibility with BSD versions of touch.
-h ,
--no-dereference
If file is a symbolic link and this option is specified, touch will modify the timestamp of the symlink, rather than its referenced file. If this option is not specified, touch will dereference symlinks before making modifications.

This option implies -c : nothing is created if file does not exist.

-m Set modification time only.
-r= reffile ,
--reference= reffile
Set the times of file to the times of file reffile instead of the current time.

In addition to having write access, the user must also own a file to set its times to the past or future.

-t timestamp Use the numeric timestamp instead of the current time. The format of timestamp is [[CC ]YY ]MMDDhhmm [.ss ].

In addition to having write access, the user must also own a file to set its times to the past or future.

--time= timetype An alternate way to specify what type of time to set (as with -a and -m ).

The value of timetype must be one of the following:

atime ,
access ,
use
Set access time. Equivalent to -a .
mtime ,
modify
Set modification time. Equivalent to -m .
This option can be specified twice nondestructively. For example, --time=atime --time=mtime is the same as -am .
--help Display a help message, and exit.
--version Display version information, and exit.

Notes

The -d option takes a human-readable date string. For example, "July 4" , "4 Jul" , "0:00" , or "Jul 4 2017 00:00:00" . If year, month, or day are omitted, the current system time values are used. If the time is omitted, midnight is used. The day may be specified before or after the month in the string. Single digit numbers may be prefixed with a zero, or not, according to preference. If seconds are specified, they are to be preceded in the time by a colon (: ).

-t takes a numeric timestamp, which expresses the month, date, hour, and minute as MMDDHHMM . For example, 07040000 would be midnight on the fourth of July. Century, years, and seconds are optional, and may be specified as CCYYMMDDHHMM.SS . If seconds are specified, they are to be preceded with a period (. ).

Specifying times in the future is okay. For example, -d "Jan 1 2029" . In addition to having write access, the user must also own a file to set its times to the past or future.

Because there is no way to manually set ctimes, the -r , -d , and -t options can modify only atimes and mtimes. When a file is touched, the ctime will always be set to the current system time.

Time zones

touch -t "10310000" - > boo.txt

Same as the previous command.

Examples

touch -d "1 Feb" file1.txt

Set the atime and mtime of file1.txt to February 1st of the current year. The ctime is set to the current system time.

Touch -d "February 1" file1.txt

Same as the previous command.

Same as the previous command.

Touch -d "01:02" file1.txt

Set the atime and mtime of file1.txt to 1:02 AM, today.

Touch -d "1:2" file1.txt

Same as the previous command.

Touch -md "Sep 1 1927 23:58:59" file1.txt

Set the mtime of file1.txt to September 1, 1927, 11:58 PM and 59 seconds. The ctime is set to the current system time. The atime is not changed.

Examples

touch --time=01020304 file1.txt

Set the atime and mtime of file1.txt to January 2, 3:04 AM of the current year. The ctime is set to the current system time.

Touch -t 01020304 file1.txt

Same as the previous command.

Touch -t 5006070405 file1.txt

Set the atime and mtime of file1.txt to June 7, 2050, 4:05 AM. The ctime is set to the current system time.

Touch -t 205007080405 file1.txt

Same as the previous command, but explicitly specifying the century (20 ).

Touch -at 195003040506.59 file1.txt

Set the atime of file1.txt to March 4, 1950, 5:06 AM and 59 seconds. The ctime is set to the current system time. The mtime is not changed.

Checking file times with stat

stat file.txt stat: cannot stat "file.txt": No such file or directory touch file.txt; stat file.txt File: "file.txt" Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: 802h/2050d Inode: 668116 Links: 1 Access: (0664/-rw-rw-r--) Uid: (1001/ hope) Gid: (1002/ hope) Access: 2017-10-25 21:35:17.368254343 -0400 Modify: 2017-10-25 21:35:17.368254343 -0400 Change: 2017-10-25 21:35:17.368254343 -0400 Birth: - touch -ad "July 12 1895" file.txt; stat file.txt File: "file.txt" Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: 802h/2050d Inode: 668116 Links: 1 Access: (0664/-rw-rw-r--) Uid: (1001/ hope) Gid: (1002/ hope) Access: 1895-07-12 00:00:00.000000000 -0500 Modify: 2017-10-25 21:35:17.368254343 -0400 Change: 2017-10-25 21:35:55.487636366 -0400 Birth: - touch -mt 198307010000 file.txt; stat file.txt File: "file.txt" Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: 802h/2050d Inode: 668116 Links: 1 Access: (0664/-rw-rw-r--) Uid: (1001/ hope) Gid: (1002/ hope) Access: 1895-07-12 00:00:00.000000000 -0500 Modify: 1983-07-01 00:00:00.000000000 -0400 Change: 2017-10-25 21:36:59.654589018 -0400 Birth: - for formatspec in "file name:\t%n" "accessed:\t%x" "modified:\t%y" "changed:\t%z"; do stat --printf="$formatspec\n" file.txt; done file name: file.txt accessed: 1895-07-12 00:00:00.000000000 -0500 modified: 1983-07-01 00:00:00.000000000 -0400 changed: 2017-10-25 21:36:59.654589018 -0400

Note: You may notice in this set of examples that when the atime was changed to July 12, 1895, the time zone changed. That"s because Daylight Savings Time (DST) was not enacted in North America until April 1, 1918.

Related commands

date — View or set the current date and time.
stat — Display the status of a file or filesystem.

touch"s syntax is

touch file_name(s)

When used without any options , touch creates new files for any file names that are provided as arguments (i.e., input data) if files with such names do not already exist. Touch can create any number of files simultaneously.

Thus, for example, the following command would create three new, empty files named file1 , file2 and file3 :

touch file1 file2 file3

A nice feature of touch is that, in contrast to some commands such as cp (which is used to copy files and directories) and mv (which is used to move or rename files and directories), it does not automatically overwrite (i.e., erase the contents of) existing files with the same name. Rather, it merely changes the last access times for such files to the current time.

Several of touch"s options are specifically designed to allow the user to change the timestamps for files. For example, the -a option changes only the access time, while the -m option changes only the modification time. The use of both of these options together changes both the access and modification times to the current time, for example:

The -r (i.e., reference ) option followed directly by a space and then by a file name tells touch to use that file"s time stamps instead of current time. For example, the following would tell it to use the times of file4 for file5 :

The -B option modifies the timestamps by going back the specified number of seconds, and the -F option modifies the time by going forward the specified number of seconds. For example, the following command would make file7 30 seconds older than file6 .

touch -r file6 -B 30 file7

The -d and -t options allow the user to add a specific last access time. The former is followed by a string (i.e., sequence of characters) in the date, month, year, minute:second format, and the latter uses a MMDDhhmm[.ss] format. For example, to change the last access time of file8 to 10:22 a.m. May 1, 2005, 1 May 2005 10:22 would be enclosed in single quotes and used as follows, i.e.,:

Partial date-time strings can be used. For example, only the date need be provided, as shown for file9 below (in which case the time is automatically set to 0:00):

Just providing the time, as shown below, automatically changes the date to the current date:

touch -d "14:24" file9

The most commonly used way to view the last modification date for files is to use the ls command with its -l option. For example, in the case of a file named file10 this would be

The complete timestamps for any file or directory can be viewed by using the stat command. For example, the following would show the timestamps for a file named file11 :

The --help option displays a basic list of options, and the --version option returns the version of the currently installed touch program.

  • Перевод

Продолжение перевода первой части руководства. Начало .

В данном отрывке рассмотрены команды работы с файловой системой и файлами, такие как ls, mkdir, touch, mv, cp, затронуто использование echo и cat. Рассказано про иноды файловой системы.

Использование команд Linux

Знакомство с ls

А сейчас, мы быстренько пройдемся по команде ls. Скорее всего вы уже хорошо знакомы с этой командой, и знаете, что набрав ls получите список содержимого текущей рабочей директории:

$ cd /usr
$ ls
X11R6 doc i686-pc-linux-gnu lib man sbin ssl bin gentoo-x86 include libexec portage share tmp distfiles i686-linux info local portage.old src

Указав опцию -a, вы можете увидеть полный список, включая скрытые файлы и директории, начинающиеся с ".". Как видно в следующем примере, ls -a выводит также особые связывающие директории "." и "..":

$ ls -a
. bin gentoo-x86 include libexec portage share tmp .. distfiles i686-linux info local portage.old src X11R6 doc i686-pc-linux-gnu lib man sbin ssl

Развернутые списки директорий

Вы также можете задать одну и более директорий или файлов в командной строке с ls. Если вы укажите файл, то ls покажет вам только этот файл. А если зададите директорию, то ls выдаст ее содержимое. Опция -l очень удобна, когда необходимо посмотреть права доступа, владельца, время последнего изменения и размер в списке содержимого директории.

В следующем примере мы использовали опцию -l чтобы отобразить содержимое моей директории /usr :

$ ls -l /usr
drwxr-xr-x 7 root root 168 Nov 24 14:02 X11R6 drwxr-xr-x 2 root root 14576 Dec 27 08:56 bin drwxr-xr-x 2 root root 8856 Dec 26 12:47 distfiles lrwxrwxrwx 1 root root 9 Dec 22 20:57 doc -> share/doc drwxr-xr-x 62 root root 1856 Dec 27 15:54 gentoo-x86 drwxr-xr-x 4 root root 152 Dec 12 23:10 i686-linux drwxr-xr-x 4 root root 96 Nov 24 13:17 i686-pc-linux-gnu drwxr-xr-x 54 root root 5992 Dec 24 22:30 include lrwxrwxrwx 1 root root 10 Dec 22 20:57 info -> share/info drwxr-xr-x 28 root root 13552 Dec 26 00:31 lib drwxr-xr-x 3 root root 72 Nov 25 00:34 libexec drwxr-xr-x 8 root root 240 Dec 22 20:57 local lrwxrwxrwx 1 root root 9 Dec 22 20:57 man -> share/man lrwxrwxrwx 1 root root 11 Dec 8 07:59 portage -> gentoo-x86/ drwxr-xr-x 60 root root 1864 Dec 8 07:55 portage.old drwxr-xr-x 3 root root 3096 Dec 22 20:57 sbin drwxr-xr-x 46 root root 1144 Dec 24 15:32 share drwxr-xr-x 8 root root 328 Dec 26 00:07 src drwxr-xr-x 6 root root 176 Nov 24 14:25 ssl lrwxrwxrwx 1 root root 10 Dec 22 20:57 tmp -> ../var/tmp

Первая колонка показывает информацию о правах доступа для каждого элемента. Чуть позже я объясню, как её интерпретировать. Следующая колонка содержит числа ссылок на каждый элемент файловой системы, позже мы вернемся к этому. Третья и четвертая колонки - это список владельцев и групп, соответственно. Пятая колонка - размер объекта. Шестая - время последнего изменения (mtime) объекта. И наконец, последняя колонка с именами объектов. Если файлы являются символическими ссылками, то вы увидите стрелку -> и путь, куда указывает эта символическая ссылка.

Смотрим на директории

Иногда вы захотите взглянуть на директорию, а не внутрь нее. В этом случае вы можете указать опцию -d, которая скажет ls рассматривать любую директорию, как внутреннюю:

$ ls -dl /usr /usr/bin /usr/X11R6/bin ../share
drwxr-xr-x 4 root root 96 Dec 18 18:17 ../share drwxr-xr-x 17 root root 576 Dec 24 09:03 /usr drwxr-xr-x 2 root root 3192 Dec 26 12:52 /usr/X11R6/bin drwxr-xr-x 2 root root 14576 Dec 27 08:56 /usr/bin

Рекурсивный и инодный списки

Так вы можете использовать -d чтобы смотреть на директорию, но также можно использовать -R для противоположного: не только лишь глянуть внутрь директории, но и рекурсивно посмотреть все директории с файлами внутри нее! Мы не включим в руководство никакого примера вывода для этой опции (поскольку обычно он очень объемный), но возможно вы захотите попробовать несколько команд ls -R и ls -Rl, чтобы почувствовать как это работает.

Наконец, опция -i может использоваться для отображения числа инодов для объектов в списке файловой системы:

$ ls -i /usr
1409 X11R6 314258 i686-linux 43090 libexec 13394 sbin 1417 bin 1513 i686-pc-linux-gnu 5120 local 13408 share 8316 distfiles 1517 include 776 man 23779 src 43 doc 1386 info 93892 portage 36737 ssl 70744 gentoo-x86 1585 lib 5132 portage.old 784 tmp

Понятие инода

Каждому объекту файловой системы назначен уникальный индекс, называемый номером инода. Это может показаться банальным, но понятие инодов очень важно для понимания большинства операций в файловой системе. Рассмотрим например ссылки "." и "..", которые появляются в каждой директории. Чтобы полностью понять, чем на самом деле является директория "..", мы сперва взглянем на номер инода у /usr/local :

$ ls -id /usr/local
5120 /usr/local

У директории /usr/local номер инода равен 5120. А теперь посмотрим номер инода у /usr/local/bin/.. :

$ ls -id /usr/local/bin/..
5120 /usr/local/bin/..

Как видно, директория /usr/local/bin/.. имеет такой же номер, как у /usr/local ! Посмотрим, как можно справиться с этим шокирующим откровением. В прошлом мы полагали, что /usr/local сама является директорией. Теперь же, мы обнаружили, что фактически директория - это инод с номером 5120, и нашли, по меньшей мере, два элемента (называемых «ссылками»), которые указывают на данный инод. И /usr/local , и /usr/local/bin/.. - ссылки на 5120-ый инод. Хотя этот инод и существует только в одном месте на диске, тем не менее на него может быть множество ссылок.

На самом деле, мы даже можем увидеть общее количество ссылок ведущих на этот, 5120 инод, используя команду ls -dl:

Если взглянуть на вторую колонку слева, то видно, что на директорию /usr/local (инод 5120) ссылаются восемь раз. На моей системе на этот инод ведут следующие пути:

/usr/local
/usr/local/.
/usr/local/bin/..
/usr/local/games/..
/usr/local/lib/..
/usr/local/sbin/..
/usr/local/share/..
/usr/local/src/..

mkdir

Давайте быстренько пройдемся по команде mkdir, которая используется для создания новых директорий. Следующий пример создает три новых директории, tic , tac , и toe , все внутри /tmp :

$ cd /tmp
$ mkdir tic tac toe

По умолчанию, команда mkdir не создает для вас родительские директории; весь путь вплоть до последнего (создаваемого) элемента должен существовать. Так, если вы захотите создать вложенные директории won/der/ful , вам придется выполнить три отдельные команды mkdir:

$ mkdir won/der/ful
mkdir: cannot create directory `won/der/ful": No such file or directory
$ mkdir won
$ mkdir won/der
$ mkdir won/der/ful

Однако, у mkdir есть очень удобная опция -p, которая говорит mkdir создавать любые отсутствующие родительские директории, как можете увидеть тут:

$ mkdir -p easy/as/pie

В целом очень просто. Чтобы узнать больше о команде mkdir наберите man mkdir и прочитайте инструкцию. Это же касается почти всех команд, рассмотренных здесь (например man ls), исключая cd, которая встроена в bash.

touch

Сейчас мы собираемся окинуть взглядом команды cp и mv, используемые для копирования, переименования и перемещения файлов и директорий. Но начнем обзор воспользовавшись командой touch, чтобы создать файл в /tmp :

$ cd /tmp
$ touch copyme

Команда touch обновляет «mtime» (время последней модификации - прим. пер.) файла, если тот существует (вспомните шестую колонку в выводе ls -l). Если файл не существует, то новый, пустой файл будет создан. Сейчас у вас должен быть файл /tmp/copyme с нулевым размером.

echo

Теперь, когда файл существует, давайте добавим немного данных в него. Можно сделать это с помощью команды echo, которая принимает аргументы и печатает их на стандартный вывод. Сперва, команда echo сама по себе:

$ echo "firstfile"
firstfile

А сейчас, та же команда echo, но с перенаправлением вывода:

$ echo "firstfile" > copyme

Знак «больше» сообщает оболочке записывать вывод echo в файл по имени copyme . Этот файл будет создан, если не существовал, или перезаписан, если существует. Набрав ls -l, увидим, что файл copyme имеет размер в 10 байт, так как содержит слово firstfile и символ новой строки:

cat и cp

Чтобы вывести содержимое файла на терминал, используйте команду cat:

$ cat copyme
firstfile

Сейчас, мы можем воспользоваться основным вызовом команды cp для создания файла copiedme из оригинального copyme :

$ cp copyme copiedme

Ниже проверим, что это действительно разные файлы; у них отличаются номера инодов:

$ ls -i copyme copiedme
648284 copiedme 650704 copyme

mv

А сейчас давайте воспользуемся командой mv для переименования copiedme в movedme . Номер иноды останется прежний; однако, имя файла, указывающее на инод, изменится.

$ mv copiedme movedme
$ ls -i movedme
648284 movedme

Номер инода у перемещаемого файла остается прежним до тех пор, пока файл назначения находится в той же файловой системе, что и исходный файл. Мы подробнее рассмотрим файловую систему в третьей части нашего руководства.

Пока мы рассказываем об mv, давайте посмотрим, как еще можно использовать эту команду. mv, помимо возможности переименовать файлы, позволяет перемещать один или более файлов в другое место в иерархии директорий. Например, чтобы переместить /var/tmp/myfile.txt в директорию /home/drobbins (которая является моей домашней), я наберу (а мог бы воспользоваться ~ - прим. пер.):

$ mv /var/tmp/myfile.txt /home/drobbins

После этого myfile.txt будет перемещен в /home/drobbins/myfile.txt . И если /home/drobbins располагается в другой файловой системе, нежели /var/tmp , команда mv скопирует myfile.txt в новую файловую систему и удалит его из старой. Как вы уже могли догадаться, когда myfile.txt перемещается между файловыми системами, то myfile.txt на новом месте получает новый номер инода. Это все потому, что у каждой файловой системы свой независимый набор номеров инодов.

Мы также можем воспользоваться mv для перемещения нескольких файлов в одну директорию. К примеру, чтобы переместить myfile1.txt и myarticle3.txt в /home/drobbins , потребуется набрать:

$ mv /var/tmp/myfile1.txt /var/tmp/myarticle3.txt /home/drobbins

Об авторах

Daniel Robbins

Дэниэль Роббинс - основатель сообщества Gentoo и создатель операционной системы Gentoo Linux. Дэниэль проживает в Нью-Мехико со свой женой Мэри и двумя энергичными дочерьми. Он также основатель и глава Funtoo , написал множество технических статей для IBM developerWorks , Intel Developer Services и C/C++ Users Journal.


Иногда ошибки TOUCH.EXE и другие системные ошибки EXE могут быть связаны с проблемами в реестре Windows. Несколько программ может использовать файл TOUCH.EXE, но когда эти программы удалены или изменены, иногда остаются "осиротевшие" (ошибочные) записи реестра EXE.

В принципе, это означает, что в то время как фактическая путь к файлу мог быть изменен, его неправильное бывшее расположение до сих пор записано в реестре Windows. Когда Windows пытается найти файл по этой некорректной ссылке (на расположение файлов на вашем компьютере), может возникнуть ошибка TOUCH.EXE. Кроме того, заражение вредоносным ПО могло повредить записи реестра, связанные с Microsoft Windows NT Server Resource Kit CD-ROM. Таким образом, эти поврежденные записи реестра EXE необходимо исправить, чтобы устранить проблему в корне.

Редактирование реестра Windows вручную с целью удаления содержащих ошибки ключей TOUCH.EXE не рекомендуется, если вы не являетесь специалистом по обслуживанию ПК. Ошибки, допущенные при редактировании реестра, могут привести к неработоспособности вашего ПК и нанести непоправимый ущерб вашей операционной системе. На самом деле, даже одна запятая, поставленная не в том месте, может воспрепятствовать загрузке компьютера!

В связи с подобным риском мы настоятельно рекомендуем использовать надежные инструменты очистки реестра, такие как %%product%% (разработанный Microsoft Gold Certified Partner), чтобы просканировать и исправить любые проблемы, связанные с TOUCH.EXE. Используя очистку реестра , вы сможете автоматизировать процесс поиска поврежденных записей реестра, ссылок на отсутствующие файлы (например, вызывающих ошибку TOUCH.EXE) и нерабочих ссылок внутри реестра. Перед каждым сканированием автоматически создается резервная копия, позволяющая отменить любые изменения одним кликом и защищающая вас от возможного повреждения компьютера. Самое приятное, что устранение ошибок реестра может резко повысить скорость и производительность системы.


Предупреждение: Если вы не являетесь опытным пользователем ПК, мы НЕ рекомендуем редактирование реестра Windows вручную. Некорректное использование Редактора реестра может привести к серьезным проблемам и потребовать переустановки Windows. Мы не гарантируем, что неполадки, являющиеся результатом неправильного использования Редактора реестра, могут быть устранены. Вы пользуетесь Редактором реестра на свой страх и риск.

Перед тем, как вручную восстанавливать реестр Windows, необходимо создать резервную копию, экспортировав часть реестра, связанную с TOUCH.EXE (например, Microsoft Windows NT Server Resource Kit CD-ROM):

  1. Нажмите на кнопку Начать .
  2. Введите "command " в строке поиска... ПОКА НЕ НАЖИМАЙТЕ ENTER !
  3. Удерживая клавиши CTRL-Shift на клавиатуре, нажмите ENTER .
  4. Будет выведено диалоговое окно для доступа.
  5. Нажмите Да .
  6. Черный ящик открывается мигающим курсором.
  7. Введите "regedit " и нажмите ENTER .
  8. В Редакторе реестра выберите ключ, связанный с TOUCH.EXE (например, Microsoft Windows NT Server Resource Kit CD-ROM), для которого требуется создать резервную копию.
  9. В меню Файл выберите Экспорт .
  10. В списке Сохранить в выберите папку, в которую вы хотите сохранить резервную копию ключа Microsoft Windows NT Server Resource Kit CD-ROM.
  11. В поле Имя файла введите название файла резервной копии, например "Microsoft Windows NT Server Resource Kit CD-ROM резервная копия".
  12. Убедитесь, что в поле Диапазон экспорта выбрано значение Выбранная ветвь .
  13. Нажмите Сохранить .
  14. Файл будет сохранен с расширением.reg .
  15. Теперь у вас есть резервная копия записи реестра, связанной с TOUCH.EXE.

Следующие шаги при ручном редактировании реестра не будут описаны в данной статье, так как с большой вероятностью могут привести к повреждению вашей системы. Если вы хотите получить больше информации о редактировании реестра вручную, пожалуйста, ознакомьтесь со ссылками ниже.

In Linux every single file is associated with timestamps, and every file stores the information of last access time, last modification time and last change time. So, whenever we create new file, access or modify an existing file, the timestamps of that file automatically updated.

Linux Touch Command Examples

In this article we will cover some useful practical examples of Linux touch command . The touch command is a standard program for Unix/Linux operating systems, that is used to create, change and modify timestamps of a file. Before heading up for touch command examples, please check out the following options.

Touch Command Options

  1. -a , change the access time only
  2. -c , if the file does not exist, do not create it
  3. -d , update the access and modification times
  4. -m , change the modification time only
  5. -r , use the access and modification times of file
  6. -t , creates a file using a specified time

1. How to Create an Empty File

The following touch command creates an empty (zero byte) new file called sheena .

# touch sheena

2. How to Create Multiple Files

By using touch command, you can also create more than one single file. For example the following command will create 3 files named, sheena , meena and leena .

# touch sheena meena leena

3. How to Change File Access and Modification Time

To change or update the last access and modification times of a file called leena , use the -a option as follows. The following command sets the current time and date on a file. If the leena file does not exist, it will create the new empty file with the name.

# touch -a leena

The most popular Linux commands such as and uses timestamps for listing and finding files.

4. How to Avoid Creating New File

Using -c option with touch command avoids creating new files. For example the following command will not create a file called leena if it does not exists.

# touch -c leena

5. How to Change File Modification Time

If you like to change the only modification time of a file called leena , then use the -m option with touch command. Please note it will only updates the last modification times (not the access times) of the file.

# touch -m leena

6. Explicitly Set the Access and Modification times

You can explicitly set the time using -c and -t option with touch command. The format would be as follows.

# touch -c -t YYDDHHMM leena

For example the following command sets the access and modification date and time to a file leena as 17:30 (17:30 p.m .) December 10 of the current year (2012 ).

# touch -c -t 12101730 leena

Next verify the access and modification time of file leena , with ls -l command.

7. How to Use the time stamp of another File

The following touch command with -r option, will update the time-stamp of file meena with the time-stamp of leena file. So, both the file holds the same time stamp.

# touch -r leena meena

8. Create a File using a specified time

If you would like to create a file with specified time other than the current time, then the format should be.

# touch -t YYMMDDHHMM.SS tecmint

For example the below command touch command with -t option will gives the tecmint file a time stamp of 18:30:55 p.m . on December 10 , 2012 .

# touch -t 201212101830.55 tecmint

We’ve almost covered all the options available in the touch command for more options use “man touch “. If we’ve still missed any options and you would like to include in this list, please update us via comment box.