watch du -sh and highlight changes
-
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. . . . -
Yes, what's the question? How to do it?
-
For example, this works...
watch "du -shx /tmp /root"
-
@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.
-
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.
-
@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
-
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.
-
I was hoping to have a solution that could do this via putty. But no?
Oh well.
-
@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.
-
@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.
-
@stacksofplates I had multiple putty sessions open, but it wasn't as clean as I was hoping.
Thanks for the tip though.
-
@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?).
-
@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?
-
@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.
-
@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.
-
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.
-
Like this...
watch "echo Old Size Was: 38M; du -shx /tmp"