{"id":15967,"date":"2019-03-14T08:30:35","date_gmt":"2019-03-14T08:30:35","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=15967"},"modified":"2024-11-21T09:45:36","modified_gmt":"2024-11-21T09:45:36","slug":"linux-touch-command","status":"publish","type":"post","link":"\/ph\/tutorials\/linux-touch-command","title":{"rendered":"Linux Touch Command: What It Is + Examples of How to Use It to Modify Timestamps"},"content":{"rendered":"<p>People usually associate the touch command in Linux with creating files. However, like many other Linux commands, it offers much broader functionality.<\/p><p>For example, Linux VPS users can use the touch command to change the timestamps of files or folders.<\/p><p>In this tutorial, we&rsquo;ll go over the Linux touch command and talk about its options and use cases.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Linux-Commands-Cheat-Sheet.pdf\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" width=\"1024\" height=\"283\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet-1024x283.png\" alt=\"\" class=\"wp-image-69262\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2022\/11\/Linux-cheat-sheet-1536x425.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2022\/11\/Linux-cheat-sheet-300x83.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2022\/11\/Linux-cheat-sheet-150x41.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2022\/11\/Linux-cheat-sheet-768x212.png 768w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2022\/11\/Linux-cheat-sheet.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-linux-touch-command-options\">Linux Touch Command Options<\/h2><p>Linux Touch Command Syntax<\/p><p>\n\n\n<div><p class=\"important\"><strong>Important!<\/strong> Before proceeding, make sure to connect to your VPS via <a href=\"\/ph\/tutorials\/how-to-use-putty-ssh\">an SSH client such as Putty<\/a>.<\/p><\/div>\n\n\n\n<\/p><p>The syntax of the touch command is:<\/p><pre class=\"wp-block-preformatted\">touch [options] [file_name]<\/pre><p>Check out the table below for all the touch command options, also known as flags:<\/p><figure tabindex=\"0\" class=\"wp-block-table is-style-regular\"><table><tbody><tr><td>Flag                                                                                                        <\/td><td>Use Case<\/td><\/tr><tr><td>-a<\/td><td>Change the access time<\/td><\/tr><tr><td>-m<\/td><td>Change the modification time<\/td><\/tr><tr><td>-c<\/td><td>Prevent creating a new file<\/td><\/tr><tr><td>-h<\/td><td>Change the symbolic link timestamp<\/td><\/tr><tr><td>-h<\/td><td>Change the timestamp for symbolic links<\/td><\/tr><tr><td>-t &lt;stamp&gt;<\/td><td>Modify the timestamp. In this case, <strong>&lt;stamp&gt;<\/strong> follows the date-time format<\/td><\/tr><tr><td>-d=&lt;string&gt;<\/td><td>Change the timestamp based on the date string<\/td><\/tr><tr><td>-r=&lt;file&gt;<\/td><td>Change the timestamp based on the reference file<\/td><\/tr><tr><td>-v or &ndash;version<\/td><td>Display the touch command version<\/td><\/tr><tr><td>&ndash;help<\/td><td>Display the help menu<\/td><\/tr><\/tbody><\/table><\/figure><h3 class=\"wp-block-heading\" id=\"h-file-timestamps\">File Timestamps<\/h3><p>In Linux, every file and folder has a timestamp that shows when a file&rsquo;s content or attributes were modified. There are three types of timestamps:<\/p><ul class=\"wp-block-list\">\n<li><strong>Access time (atime)<\/strong> &ndash; last time a file was read.<\/li>\n\n\n\n<li><strong>Modification time (mtime)<\/strong> &ndash; last time a file&rsquo;s content was modified. Like access time, it is also part of the file status metadata.<\/li>\n\n\n\n<li><strong>Changed time (ctime)<\/strong> &ndash; last time a file&rsquo;s metadata was changed. For example, permissions.<\/li>\n<\/ul><p>As a result, the Linux touch command is mainly used to manipulate file or folder access and modification time.<\/p><p>Keep in mind that there is no way to set or change <strong>ctime<\/strong> manually. Since <strong>atime<\/strong> and <strong>mtime<\/strong> are part of a file&rsquo;s status metadata, changing <strong>atime<\/strong> or <strong>mtime<\/strong> of the file results in <strong>ctime<\/strong>, which is automatically set to the current time.<\/p><h2 class=\"wp-block-heading\" id=\"h-linux-touch-command-examples\">Linux touch Command Examples<\/h2><p>Here are a few useful examples of the touch command on a Linux system.<\/p><h3 class=\"wp-block-heading\" id=\"h-using-touch-to-create-a-file\">Using touch to Create a File<\/h3><p>If you use the touch command without any options, it will simply create a new empty file. If the file already exists, the touch command will update the access and modification times to the current time without changing the file contents.<\/p><pre class=\"wp-block-preformatted\">touch file_name.txt<\/pre><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-terminal-window-showcases-the-touch-command-to-create-a-new-file.-Ls-l-command-shows-the-file-creation-time-stamp.png\"><img decoding=\"async\" width=\"736\" height=\"140\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-terminal-window-showcases-the-touch-command-to-create-a-new-file.-Ls-l-command-shows-the-file-creation-time-stamp.png\" alt=\"The terminal window showcases the touch command to create a new file. Ls -l command shows the file creation time stamp\" class=\"wp-image-73133\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-showcases-the-touch-command-to-create-a-new-file.-Ls-l-command-shows-the-file-creation-time-stamp.png 736w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-showcases-the-touch-command-to-create-a-new-file.-Ls-l-command-shows-the-file-creation-time-stamp-300x57.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-showcases-the-touch-command-to-create-a-new-file.-Ls-l-command-shows-the-file-creation-time-stamp-150x29.png 150w\" sizes=\"(max-width: 736px) 100vw, 736px\" \/><\/a><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-using-touch-to-create-multiple-files\">Using touch to Create Multiple Files<\/h3><p>It is also possible to create multiple files using a single touch command. To do that, specify the names of the files with spaces between them. It would look like this in the command line:<\/p><pre class=\"wp-block-preformatted\">touch file_name1.txt file_name2.txt file_name3.txt<\/pre><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-terminal-window-shows-the-touch-command-to-create-empty-files.-Touch-creates-three-empty-files-as-a-result.png\"><img decoding=\"async\" width=\"904\" height=\"226\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-terminal-window-shows-the-touch-command-to-create-empty-files.-Touch-creates-three-empty-files-as-a-result.png\" alt=\"The terminal window shows the touch command to create empty files. Touch creates three empty files as a result\" class=\"wp-image-73134\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-create-empty-files.-Touch-creates-three-empty-files-as-a-result.png 904w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-create-empty-files.-Touch-creates-three-empty-files-as-a-result-300x75.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-create-empty-files.-Touch-creates-three-empty-files-as-a-result-150x38.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-create-empty-files.-Touch-creates-three-empty-files-as-a-result-768x192.png 768w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/a><\/figure><\/div><p>You can auto-generate file names using curl braces while creating multiple files, like in the following example:<\/p><pre class=\"wp-block-preformatted\">touch file_name{1..3}.txt<\/pre><p>The above touch command will create three files named <strong>file_name1.txt<\/strong>,<strong> file_name2.txt, <\/strong>and<strong> file_name3.txt<\/strong>.<\/p><h3 class=\"wp-block-heading\" id=\"h-using-touch-to-change-access-time\">Using touch to Change Access Time<\/h3><p>To change the access time of a file to the current time, use the <strong>a<\/strong> option followed by the file name with the touch command like in the following example:<\/p><pre class=\"wp-block-preformatted\">touch -a file_name.txt<\/pre><p>Then, check the access time with the following command:<\/p><pre class=\"wp-block-preformatted\">ls -lu file_name.txt<\/pre><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-terminal-window-shows-the-touch-command-to-change-only-file-access-time-for-a-single-file-1.png\"><img decoding=\"async\" width=\"732\" height=\"110\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-terminal-window-shows-the-touch-command-to-change-only-file-access-time-for-a-single-file-1.png\" alt=\"The terminal window shows the touch command to change only file access time for a single file\" class=\"wp-image-73136\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-change-only-file-access-time-for-a-single-file-1.png 732w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-change-only-file-access-time-for-a-single-file-1-300x45.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-change-only-file-access-time-for-a-single-file-1-150x23.png 150w\" sizes=\"(max-width: 732px) 100vw, 732px\" \/><\/a><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-using-touch-to-change-modification-time\">Using touch to Change Modification Time<\/h3><p>The <strong>m<\/strong> option, along with the touch command, changes the modification time of a file to the current time:<\/p><pre class=\"wp-block-preformatted\">touch -m file_name.txt<\/pre><figure class=\"wp-block-image aligncenter size-full\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-terminal-window-shows-the-touch-command-to-change-only-modification-time-of-a-given-file.-While-ls-l-command-displays-modify-time.png\"><img decoding=\"async\" width=\"728\" height=\"114\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-terminal-window-shows-the-touch-command-to-change-only-modification-time-of-a-given-file.-While-ls-l-command-displays-modify-time.png\" alt=\"The terminal window shows the touch command to change only modification time of a given file. While ls -l command displays modify time\n\" class=\"wp-image-73137\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-change-only-modification-time-of-a-given-file.-While-ls-l-command-displays-modify-time.png 728w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-change-only-modification-time-of-a-given-file.-While-ls-l-command-displays-modify-time-300x47.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-change-only-modification-time-of-a-given-file.-While-ls-l-command-displays-modify-time-150x23.png 150w\" sizes=\"(max-width: 728px) 100vw, 728px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\" id=\"h-using-touch-to-change-access-and-modification-time\">Using touch to Change Access and Modification Time<\/h3><p>To change both access time and modification time with a single command, use the options <strong>a<\/strong> and <strong>m<\/strong> together:<\/p><pre class=\"wp-block-preformatted\">touch -am file_name.txt<\/pre><p>Now, check the date with both of these commands:<\/p><pre class=\"wp-block-preformatted\">ls -l file_name.txt\nls -lu file_name.txt<\/pre><figure class=\"wp-block-image aligncenter size-full\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-terminal-window-shows-the-touch-command-to-change-modification-and-access-time-for-a-given-file..png\"><img decoding=\"async\" width=\"734\" height=\"172\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-terminal-window-shows-the-touch-command-to-change-modification-and-access-time-for-a-given-file..png\" alt=\"The terminal window shows the touch command to change modification and access time for a given file. While ls -l and ls -l displays the modification date along with the last access time\n\" class=\"wp-image-73138\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-change-modification-and-access-time-for-a-given-file..png 734w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-change-modification-and-access-time-for-a-given-file.-300x70.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-change-modification-and-access-time-for-a-given-file.-150x35.png 150w\" sizes=\"(max-width: 734px) 100vw, 734px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\" id=\"h-using-touch-to-change-access-time-without-creating-a-new-file\">Using touch to Change Access Time Without Creating a New File<\/h3><p>In some situations, you want to change an existing file&rsquo;s access and modification time to the current time without actually creating a new one. To do that, use the <strong>c<\/strong> option followed by the file name with the touch command.<\/p><pre class=\"wp-block-preformatted\">touch -c new_file.txt<\/pre><h3 class=\"wp-block-heading\" id=\"h-using-touch-to-set-specific-access-and-modification-time\">Using touch to Set Specific Access and Modification Time<\/h3><p>It is also possible to set a file&rsquo;s access and modification time to a particular date by using the<strong> t<\/strong> option followed by a date-time. It would look like this:<\/p><pre class=\"wp-block-preformatted\">touch -t 202203081047.30 file_name.txt<\/pre><p>Make sure to check whether the date changed with the following command:<\/p><pre class=\"wp-block-preformatted\">ls -lu file_name.txt<\/pre><figure class=\"wp-block-image aligncenter size-full\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-terminal-window-shows-the-touch-command-to-set-a-specific-timestamp-for-modification-and-access-times-for-a-given-file.-While-ls-lu-displays-the-specified-time.png\"><img decoding=\"async\" width=\"818\" height=\"110\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-terminal-window-shows-the-touch-command-to-set-a-specific-timestamp-for-modification-and-access-times-for-a-given-file.-While-ls-lu-displays-the-specified-time.png\" alt=\"The terminal window shows the touch command to set a specific timestamp for modification and access times for a given file. While ls -lu displays the specified time\n\" class=\"wp-image-73139\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-set-a-specific-timestamp-for-modification-and-access-times-for-a-given-file.-While-ls-lu-displays-the-specified-time.png 818w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-set-a-specific-timestamp-for-modification-and-access-times-for-a-given-file.-While-ls-lu-displays-the-specified-time-300x40.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-set-a-specific-timestamp-for-modification-and-access-times-for-a-given-file.-While-ls-lu-displays-the-specified-time-150x20.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-set-a-specific-timestamp-for-modification-and-access-times-for-a-given-file.-While-ls-lu-displays-the-specified-time-768x103.png 768w\" sizes=\"(max-width: 818px) 100vw, 818px\" \/><\/a><\/figure><p>Remember that the date-time format must follow the <strong>CCYYMMDDhhmm.ss <\/strong>style:<\/p><ul class=\"wp-block-list\">\n<li><strong>CC<\/strong> &ndash; the first two digits of the year<\/li>\n\n\n\n<li><strong>YY<\/strong> &ndash; the second two digits of the year<\/li>\n\n\n\n<li><strong>MM<\/strong> &ndash; the month of the year (01-12)<\/li>\n\n\n\n<li><strong>DD<\/strong> &ndash; the day of the month (01-31)<\/li>\n\n\n\n<li><strong>hh <\/strong>&ndash; the hour of the day (00-23)<\/li>\n\n\n\n<li><strong>mm<\/strong> &ndash; the minute of the hour (00-59)<\/li>\n\n\n\n<li><strong>ss <\/strong>&ndash; the second of the minute (00-59)<\/li>\n<\/ul><h3 class=\"wp-block-heading\" id=\"h-using-touch-to-change-timestamp-using-a-symbolic-link\">Using touch to Change Timestamp Using a Symbolic Link<\/h3><p>When you use a symbolically linked file name with the Linux touch command, the timestamp information for the original file, that was pointed by the link file, gets modified. To change the access and modification time to the current time for a symbolically linked file, use the <strong>h<\/strong> option:<\/p><pre class=\"wp-block-preformatted\">touch -h SymbolicLinkFile<\/pre><h3 class=\"wp-block-heading\" id=\"h-using-touch-to-set-timestamp-using-a-reference-file\">Using touch to Set Timestamp Using a Reference File<\/h3><p>The Linux touch command can also set a file&rsquo;s access and modification time by reading the timestamp information from another file. For example, the following touch command with the <strong>r<\/strong> option will scan the timestamp information from <strong>reference.txt<\/strong> and set these timestamp values to <strong>file_name.txt<\/strong>. Here&rsquo;s an example of the command:<\/p><pre class=\"wp-block-preformatted\">touch -r reference.txt file_name.txt<\/pre><figure class=\"wp-block-image aligncenter size-full\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-terminal-window-shows-the-touch-command-to-modify-the-timestamp-format-using-a-referenced-file.-While-ls-l-command-displays-the-modification-timestamps-for-the-existing-files.png\"><img decoding=\"async\" width=\"732\" height=\"282\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-terminal-window-shows-the-touch-command-to-modify-the-timestamp-format-using-a-referenced-file.-While-ls-l-command-displays-the-modification-timestamps-for-the-existing-files.png\" alt=\"The terminal window shows the touch command to modify the timestamp format using a referenced file. While ls -l command displays the modification timestamps for the existing files\n\" class=\"wp-image-73140\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-modify-the-timestamp-format-using-a-referenced-file.-While-ls-l-command-displays-the-modification-timestamps-for-the-existing-files.png 732w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-modify-the-timestamp-format-using-a-referenced-file.-While-ls-l-command-displays-the-modification-timestamps-for-the-existing-files-300x116.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/03\/The-terminal-window-shows-the-touch-command-to-modify-the-timestamp-format-using-a-referenced-file.-While-ls-l-command-displays-the-modification-timestamps-for-the-existing-files-150x58.png 150w\" sizes=\"(max-width: 732px) 100vw, 732px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\" id=\"h-using-touch-to-specify-the-date-and-time-as-a-string\">Using touch to Specify the Date and Time as a String<\/h3><p>You can also specify the date and time as a string by using the <strong>d<\/strong> option. The following Linux touch command example sets the date to the 8th of March, and the time is automatically set to 00:00.<\/p><pre class=\"wp-block-preformatted\">touch -d '8 Mar' file_name.txt<\/pre><p>Instead of specifying the date as a string, you can select the time as one. In that case, the date will be set to the current date automatically:<\/p><pre class=\"wp-block-preformatted\">touch -d '20:10' file_name.txt<\/pre><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a href=\"\/ph\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner-1024x300.png\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/02\/VPS-hosting-banner.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/02\/VPS-hosting-banner-300x88.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/02\/VPS-hosting-banner-150x44.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/02\/VPS-hosting-banner-768x225.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>Manipulating access, modification, and changing times for files and folders can be helpful for any Linux user. That is where the touch command comes in.<\/p><p>In this tutorial, we&rsquo;ve covered the usage of the Linux touch command and included the most commonly used options for it. We&rsquo;ve also provided a few use cases for this command that you can try on your system.<\/p><p>If you have any questions, let us know in the comments section below.<\/p><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Learn More Linux Commands for File Management<\/h4>\n                    <p><a href=\"\/ph\/tutorials\/how-to-remove-files-and-folders-using-linux-command-line\/\">How to Remove Files and Directories<\/a><br>\n<a href=\"\/ph\/tutorials\/how-to-use-find-and-locate-commands-in-linux\/\">How to Locate a File<\/a><br>\n<a href=\"\/ph\/tutorials\/linux-tar-command-with-examples\/\">How to Compress a File with Tar Command<\/a><br>\n<a href=\"\/ph\/tutorials\/linux-chown-command\/\">How to Change File Ownership with Chown Command<\/a><br>\n<a href=\"\/ph\/tutorials\/how-to-unzip-files-linux\/\">How to Unzip Files in Linux<\/a><br>\n<a href=\"\/ph\/tutorials\/vps\/change-linux-permissions-and-owners\">How to Change FIle Permissions with Chmod Command<\/a><br>\n<a href=\"\/ph\/tutorials\/how-to-rename-files-in-linux\/\">How to Rename a File<\/a><br>\n<a href=\"\/ph\/tutorials\/linux-file-command\/\">How to Check File Type<\/a><br>\n<a href=\"\/ph\/tutorials\/how-to-create-symbolic-links-in-linux\/\">How to Create a Symbolic Link (Symlink)<\/a><br>\n<a href=\"\/ph\/tutorials\/how-to-use-rsync\/\">How to Synchronize Files Using rsync Command<\/a><\/p>\n                <\/div>\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>People usually associate the touch command in Linux with creating files. However, like many other Linux commands, it offers much broader functionality. For example, Linux VPS users can use the touch command to change the timestamps of files or folders. In this tutorial, we&rsquo;ll go over the Linux touch command and talk about its options [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ph\/tutorials\/linux-touch-command\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":110,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"What Is Linux Touch Command + Practical Usage Examples","rank_math_description":"The Linux touch command is a standard command used to modify the timestamps of a file. Learn how to use the touch command in this article.","rank_math_focus_keyword":"linux touch command","footnotes":""},"categories":[22643,22639],"tags":[],"class_list":["post-15967","post","type-post","status-publish","format-standard","hentry","category-managing-monitoring-and-security","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/linux-touch-command","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/commande-touch-de-linux","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/usar-comando-touch-linux-ejemplos","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/touch-command-linux","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/linux-touch-command","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/linux-touch-command","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/linux-touch-command","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/usar-comando-touch-linux-ejemplos","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/usar-comando-touch-linux-ejemplos","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/usar-comando-touch-linux-ejemplos","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/linux-touch-command","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/linux-touch-command","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/linux-touch-command","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/linux-touch-command","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/15967","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/comments?post=15967"}],"version-history":[{"count":19,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/15967\/revisions"}],"predecessor-version":[{"id":112472,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/15967\/revisions\/112472"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/media?parent=15967"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/categories?post=15967"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/tags?post=15967"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}