1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

pipe to txt file?

Discussion in 'Linux / Unix Discussion' started by twizzle, Oct 15, 2010.

  1. twizzle

    twizzle Gigabyte Poster

    I'm trying to monitor a linux server from command line. I know i can monitor processes, uptime and cpu usage with commands such as pstree and uptime etc. But can i pipe these to a txt file to download and view on a windows box later? Can anyone tell me how to do this? Also can i do this remotley using Putty? I dont have physical access to the server.

    Also could i use a Cron command to schedule this for each day so all i need do is login and copy the txt file to my pc?
    Last edited: Oct 15, 2010
    Certifications: Comptia A+, N+, MS 70-271, 70-272
    WIP: Being a BILB,
  2. ThomasMc

    ThomasMc Gigabyte Poster

    command > test.txt


    And use WinSCP to download it
    Last edited: Oct 16, 2010
    Certifications: MCDST|FtOCC
    WIP: MCSA(70-270|70-290|70-291)
  3. FreakyBeanz

    FreakyBeanz Bit Poster

    Please bear in mind, that a redirect of ">" will overwrite an existing file of the same name if one exists.

    If you want to setup a cron entry to monitor the system every 5 minutes you might be better off using something like:

    $ command >> monitoring_`date +%Y%m%d`

    All of the day's monitoring would end up in a single file called: monitoring_YYYYMMDD (where YYYY = Year e.g. 2010, MM = Month e.g. 10 for October, and DD = day e.g. 23) - and the file would be appended to each time the command ran, until the date changes, and a new file will be created.
    Certifications: RHCT
    WIP: CompTIA Linux+
  4. sheepluv

    sheepluv Byte Poster

    you could also mount a windows share to copy the text file to to save you login on everyday


    mount -t smbfs //servername/sharename /mountdirectory -o username=mywindowsusername,password=mywindowspassword

    EDIT - Nice of me to resurrect this post, didnt notice the date! :blink
    Last edited: Feb 16, 2011
    Certifications: CCNA | HND | 70-646
  5. Apexes

    Apexes Gigabyte Poster

    lol, did look at the date and was like :blink

    Certifications: 70-243 MCTS: ConfigMgr 2012 | MCSE: Private Cloud

Share This Page