Which command is used to create empty files?

Study for the AP Networking Test. Use flashcards and multiple-choice questions for effective learning. Equip yourself with hints and explanations to ensure exam success. Get ready to excel!

Multiple Choice

Which command is used to create empty files?

Explanation:
Creating an empty file quickly and predictably is done with the touch command. When you run touch followed by a filename, it creates a new, empty file with that name if it doesn’t exist yet. If the file already exists, touch simply updates its access and modification timestamps without changing any content. That makes it the standard tool for this common task. Other options don’t fit as cleanly. The cat command is used to display or combine file contents, and while you can create a file with cat by using redirection (for example, cat > filename and then ending input), that method is awkward for simply creating an empty file and isn’t the typical approach. The whoami command shows the current user, not anything about files. NIC is not a command; it refers to a network interface card, a hardware term rather than a tool for file creation.

Creating an empty file quickly and predictably is done with the touch command. When you run touch followed by a filename, it creates a new, empty file with that name if it doesn’t exist yet. If the file already exists, touch simply updates its access and modification timestamps without changing any content. That makes it the standard tool for this common task.

Other options don’t fit as cleanly. The cat command is used to display or combine file contents, and while you can create a file with cat by using redirection (for example, cat > filename and then ending input), that method is awkward for simply creating an empty file and isn’t the typical approach. The whoami command shows the current user, not anything about files. NIC is not a command; it refers to a network interface card, a hardware term rather than a tool for file creation.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy