How to write the output of a command to a file?



How to write the output of a command to a file?..

Answer / Manish Yadav

To write the output of a command to a file in Linux, you can use output redirection. Append '> filename' or '>> filename' at the end of your command to redirect output. For example, 'ls -l > outputfile' writes the list of files and directories (output of 'ls -l') to 'outputfile'. The '>> filename' appends the output to 'filename' if it already exists.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Linux Commands Interview Questions

What command is used to check the number of files, disk space, and each user’s defined quota?

1 Answers  


why context switching time should be minimum? How it depends on hardware support?

1 Answers   Flipkart,


You want to verify which lines in the file kickoff contain ‘bob’. Which of the following commands will accomplish this?

1 Answers  


How would you find whether a remote server is up or not?

8 Answers   HP,


Explain difference between swap partition and swap file?

1 Answers  


How to FTP user access other directory except his own home directory ?

2 Answers   IBM,


Is llvm a compiler?

1 Answers  


What does the top command display?

10 Answers   iNautix, Yahoo,


What does curl command do in linux?

1 Answers  


What is cat command in linux?

1 Answers  


How do I permanently set ulimit in linux?

1 Answers  


Write a command that will do the following: -look for all files in the current and subsequent directories with an extension c,v -strip the,v from the result (you can use sed command) -use the result and use a grep command to search for all occurrences of the word orange in the files.

1 Answers  


Categories