Writing Terminal Output to a File
Whenever I have an installation running remotely at a physical location, I often need to monitor the state of that installation. I use a specific Dropbox install and then write to a log file from whatever software I have running, which works well. Yet sometimes I may also have a process running on the command line in a terminal session and also need a way to log that output to a file for remote viewing. Of course with this being the command line there are a myriad of ways to do this, but here's what I recently setup using a thing called tee.
Tee is a command which can read STDOUT and can write to a file or multiple files. To do this I used:
yourCommand | tee -a file-path-to-write-to.log
I pipe the command I want to use into tee, then use the -a flag as I want to append to the file, not overwrite it, then I put the file path.
If I make the file path to be inside a Dropbox directory, I can view the terminal output remotely.
Hope that may come in handy for some.