I am trying to output the ps command to a file in /home/username/ps.txt. I want to create the file on the go, write the output of ps to it and also read the same in a single command.
I tried this:
ps > /home/username/ps.txt | less /home/username/ps.txt
It writes to the file after creating it but does not output it. But using less seperately gives proper output.
Could I perform this in a single command?
&&– Jeff Schaller May 04 '16 at 10:58