QuestionQ178

VerifiedEssential Commands

Which of the following commands redirects the output of cmd to the file foo.txt, overwriting any existing file with that name?

Explanation

The single greater-than sign (>) is the standard shell redirection operator that sends a command's standard output to a file, truncating and overwriting the file if it already exists, or creating it if it does not. In contrast, >> appends output to an existing file without overwriting it, | pipes output to another command rather than a file, and &&/|| are used for conditional execution of subsequent commands, not for output redirection.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!