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.txtIt 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?
Ouput to a file and read it
ubuntu;cat;less
tee writes both to file and stdout , use that:ps -ef | tee psoutput.txt | lessOr just use && to open file with less upon successful completion of psps -ef > psoutput.txt && less psoutput.txt