50.7k views
0 votes
Which command creates an empty file if file does not exist?
1) cat
2) touch
3) ed

1 Answer

4 votes

Final answer:

The command to create an empty file in Unix-like operating systems is 'touch'. It not only creates a new file if it doesn't exist but also updates the file's timestamp. Simply using 'touch filename' will accomplish this.

Step-by-step explanation:

The command to create an empty file if the file does not already exist is touch. The touch command can be easily used by typing touch filename into the terminal, and it will create a new file with the name 'filename' if it doesn't exist or update the timestamp if it already exists. While cat can also be used for creating files, it is primarily designed for concatenating and displaying the content of files, and ed is a text editor which could also create files in a more roundabout way, but is not typically used for this simple action.

User Hounded
by
8.2k points