Which of the following commands is/are used to create files in Linux?…
2023
Which of the following commands is/are used to create files in Linux? Commands: i) touch ii) cat iii) head iv) finger
- A.
i, ii and iii only
- B.
ii, iii and iv only
- C.
i and ii only
- D.
i only
Attempted by 82 students.
Show answer & explanation
Correct answer: C
In the Linux operating system, files can be created using various commands, but they must have the functional capability to generate a new entry in the file system.
i) touch: This is the most common command used to create an empty file. It is primarily used to update timestamps, but if the file does not exist, it creates it.
ii) cat: While primarily used to display file contents, the
catcommand can create a file when used with the redirection operator (e.g.,cat > filename.txt). This allows a user to input text directly into a new file.
The other commands listed (head and finger) are used for viewing data or system information and do not have a built-in function to create new files.