ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    watch du -sh and highlight changes

    Scheduled Pinned Locked Moved IT Discussion
    linuxcommand lineputtyfile storage
    17 Posts 3 Posters 2.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DustinB3403D
      DustinB3403
      last edited by

      Is there a way to perform a watch du -sh <bunch of file paths> and highlight the differences to see if things are changing?

      The reason I'm not using watch du -sh * is because of bad naming conventions. . . .

      1 Reply Last reply Reply Quote 1
      • scottalanmillerS
        scottalanmiller
        last edited by

        Yes, what's the question? How to do it?

        1 Reply Last reply Reply Quote 0
        • scottalanmillerS
          scottalanmiller
          last edited by

          For example, this works...

          watch "du -shx /tmp /root"
          
          DustinB3403D 1 Reply Last reply Reply Quote 0
          • DustinB3403D
            DustinB3403 @scottalanmiller
            last edited by

            @scottalanmiller said in watch du -sh and highlight changes:

            For example, this works...

            watch "du -shx /tmp /root"
            

            I mean highlight as in bold red or green color the changes as the watch process proceeds.

            1 Reply Last reply Reply Quote 0
            • DustinB3403D
              DustinB3403
              last edited by

              Essentially, I want to be able to watch a file directory on a server, and see if people are cleaning it up when I tell them to clean it up. As close to real time as possible.

              scottalanmillerS 1 Reply Last reply Reply Quote 0
              • scottalanmillerS
                scottalanmiller @DustinB3403
                last edited by

                @dustinb3403 said in watch du -sh and highlight changes:

                Essentially, I want to be able to watch a file directory on a server, and see if people are cleaning it up when I tell them to clean it up. As close to real time as possible.

                OH! You meant watch in the English sense, not watch in the UNIX command sense? Because you wrote an exact UNIX command in your request 🙂

                1 Reply Last reply Reply Quote 1
                • scottalanmillerS
                  scottalanmiller
                  last edited by

                  What what you want, you have to write a script to do that. Something that will record what there was, what there is now, when it changed and what you wanted to have changed.

                  1 Reply Last reply Reply Quote 0
                  • DustinB3403D
                    DustinB3403
                    last edited by

                    I was hoping to have a solution that could do this via putty. But no?

                    Oh well.

                    stacksofplatesS scottalanmillerS 2 Replies Last reply Reply Quote 0
                    • stacksofplatesS
                      stacksofplates @DustinB3403
                      last edited by

                      @dustinb3403 said in watch du -sh and highlight changes:

                      I was hoping to have a solution that could do this via putty. But no?

                      Oh well.

                      Open multiple PuTTYs and do a watch command. That's about your only option (or tmux) if you don't want to script it.

                      DustinB3403D 1 Reply Last reply Reply Quote 0
                      • scottalanmillerS
                        scottalanmiller @DustinB3403
                        last edited by

                        @dustinb3403 said in watch du -sh and highlight changes:

                        I was hoping to have a solution that could do this via putty. But no?

                        Oh well.

                        Well sure, a script that you write and run via PuTTY. Something has to have the business logic and storage history that you want to compare against. That's the script. You can obviously use PuTTY, though.

                        1 Reply Last reply Reply Quote 0
                        • DustinB3403D
                          DustinB3403 @stacksofplates
                          last edited by

                          @stacksofplates I had multiple putty sessions open, but it wasn't as clean as I was hoping.

                          Thanks for the tip though.

                          stacksofplatesS scottalanmillerS 2 Replies Last reply Reply Quote 0
                          • stacksofplatesS
                            stacksofplates @DustinB3403
                            last edited by

                            @dustinb3403 said in watch du -sh and highlight changes:

                            @stacksofplates I had multiple putty sessions open, but it wasn't as clean as I was hoping.

                            Thanks for the tip though.

                            Tmux would probably be cleaner, but that's all up to whether you want to set up a session for this process (assuming you're only doing it once?).

                            1 Reply Last reply Reply Quote 0
                            • scottalanmillerS
                              scottalanmiller @DustinB3403
                              last edited by

                              @dustinb3403 said in watch du -sh and highlight changes:

                              @stacksofplates I had multiple putty sessions open, but it wasn't as clean as I was hoping.

                              Thanks for the tip though.

                              What makes having multiple sessions easier?

                              DustinB3403D 1 Reply Last reply Reply Quote 0
                              • DustinB3403D
                                DustinB3403 @scottalanmiller
                                last edited by

                                @scottalanmiller said in watch du -sh and highlight changes:

                                @dustinb3403 said in watch du -sh and highlight changes:

                                @stacksofplates I had multiple putty sessions open, but it wasn't as clean as I was hoping.

                                Thanks for the tip though.

                                What makes having multiple sessions easier?

                                One session I simply listed the folder sizes, and it remained static. On the other session I had it watching those folders for changes.

                                It worked, but wasn't as clean as I had hoped.

                                scottalanmillerS 1 Reply Last reply Reply Quote 0
                                • scottalanmillerS
                                  scottalanmiller @DustinB3403
                                  last edited by

                                  @dustinb3403 said in watch du -sh and highlight changes:

                                  @scottalanmiller said in watch du -sh and highlight changes:

                                  @dustinb3403 said in watch du -sh and highlight changes:

                                  @stacksofplates I had multiple putty sessions open, but it wasn't as clean as I was hoping.

                                  Thanks for the tip though.

                                  What makes having multiple sessions easier?

                                  One session I simply listed the folder sizes, and it remained static. On the other session I had it watching those folders for changes.

                                  It worked, but wasn't as clean as I had hoped.

                                  OH! I see.

                                  1 Reply Last reply Reply Quote 0
                                  • scottalanmillerS
                                    scottalanmiller
                                    last edited by

                                    You could easily output the old info to a file or print it out via an echo. Then show the live data, all in one command.

                                    1 Reply Last reply Reply Quote 0
                                    • scottalanmillerS
                                      scottalanmiller
                                      last edited by

                                      Like this...

                                      watch "echo Old Size Was: 38M; du -shx /tmp"
                                      
                                      1 Reply Last reply Reply Quote 0
                                      • 1 / 1
                                      • First post
                                        Last post