Which of the following commands creates or, in case it already exists, overwrites a file called data with the output of ls?
Which of the following commands creates or, in case it already exists, overwrites a file called data with the output of ls?
The command 'ls > data' creates a new file named 'data' if it does not exist or overwrites it if it already exists with the output of the 'ls' command. The '>' operator is used in Unix-like systems for redirecting the standard output of a command to a file, replacing the file’s content if it already exists.
Line C is the correct answer.
Both C and B are correct, tested all options in CentOS. but I agree the only answer recognized as correct (for some reason) will be C.
C very easy and basic
Correct.