Creating a File with touch
To create an empty file called filename within your current directory, use the following command:
matthew@seymour:~$ touch filename
To edit this file, you must use a text editor. Several are discussed in Chapter 13, “Automating Tasks and Shell Scripting.” However, it is sometimes useful to create an empty file as this creates an access record because of the time and date information that is connected to the file. You can also use touch
to update this information, called a timestamp, without otherwise accessing or modifying a file.
You can create a file in a different location by changing what is after touch
. To create a new file in /home/matthew/randomdirectory
, if I am already in my home ...
Get Ubuntu Unleashed 2014 Edition: Covering 13.10 and 14.04,Ninth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.