Skip to content
Advertisement

how to send output of ‘ls-l’ to cp command using pipes?

i want to copy the output of ls -l command into a file say “xyz”. i know i have to take the output of ls -l and then send it to cp command using pipe i.e output of ls-l will be used as an input for cp command

JavaScript

Advertisement

Answer

Output to file “test.txt”:

JavaScript

Sumary of pipes:

  • > Save output to a file.

  • >> Append output to a file.

  • < Read input from a file.

  • 2> Redirect error messages.

  • | Send the output from one program as input to another program.

Advertisement