5. touch
Lesson Content
Let’s learn how to make some files. A very simple way is to use the touch command. Touch allows you to the create new empty files.
$ touch mysuperduperfile
And boom, new file!
Touch is also used to change timestamps on existing files and directories. Give it a try, do an ls -l on a file and note the timestamp, then touch that file and it will update the timestamp.
There are many other ways to create files that involve other things like redirection and text editors, but we’ll get to that in the Text Manipulation course.
Exercise
- Create a new file
- Note the timestamp
- Touch the file and check the timestamp once again
Quiz Question
# How do you create a file called myfile?
> touch is a command used to update the access date and/or modification date of a computer file or directory.
1. [ ] create myfile
2. [ ] new myfile
3. [x] touch myfile