[HN Gopher] Pipe Viewer - A Unix Utility You Should Know About
       ___________________________________________________________________
        
       Pipe Viewer - A Unix Utility You Should Know About
        
       Author : lnyan
       Score  : 50 points
       Date   : 2024-11-20 15:09 UTC (7 hours ago)
        
 (HTM) web link (catonmat.net)
 (TXT) w3m dump (catonmat.net)
        
       | emptiestplace wrote:
       | > The obvious way to do it is:
       | 
       | > $ gzip -c access.log > access.log.gz
       | 
       | Is it?
        
       | heinrich5991 wrote:
       | There's also `progress` which works for tools mainly operating on
       | a single file, but unlike `pv`, you don't have to start the tool
       | differently. It'd e.g. work nicely for the `gzip` example. Just
       | call `progress` on a different terminal while `gzip` is running.
        
       | thanatos519 wrote:
       | Yes! My `,pv` is approximately: (probably a better way to make
       | the k, but I stop once something is adequate; maybe I just need
       | to make a `,,kof`)                   tar cpS "$@" --sort=name |
       | pv -bratpes $(du -cks "$@"|sed -n '/.total$/ s/.total$//p')k
       | 
       | Which gives me progress bars for big copies like:
       | ,pv files/ | tar xp -C /destination              ,pv files/ | ssh
       | overthere tar xp -C /destination
        
       | mort96 wrote:
       | Pipe viewer is excellent. I use it all the time.
       | 
       | As of version 1.8.10[1], which includes my merge request[2] to
       | add an '--output' option, it has even completely replaced my use
       | of 'dd' for writing disk images: 'sudo pv -Yo /dev/mmcblk0
       | whatever.img' is nicer, has much better progress indication,
       | automatically selects a more sensible buffer size, _and_ begets
       | fewer groans from UNIX neckbeards, than the old  'sudo dd
       | of=/dev/mmcblk0 if=whatever.img'. (The '-Y' causes pv to sync
       | after each write, which greatly improves progress indication in
       | Linux.)
       | 
       | Though it's useful for much more of course. I use it for progress
       | when compressing files ('pv blah | gzip ...'), when uploading
       | files to the web ('pv blah | curl --upload-file - ...' -- curl
       | doesn't show progress when uploading for whatever reason), or
       | just when I wanna see that _something_ is happening with an
       | operation which would otherwise take a while (even things like a
       | slow  'du -h /some/path | sort -h' benefits from a 'pv' squeezed
       | in the middle just to indicate that something is happening).
       | 
       | [1] https://codeberg.org/a-j-wood/pv/releases/tag/v1.8.10
       | 
       | [2] https://codeberg.org/a-j-wood/pv/pulls/90
        
       | 6c696e7578 wrote:
       | A little more typing, but I find dd present on most systems
       | already, so I tend to do this:                 tar ... | dd
       | status=progress | ...
        
         | Aachen wrote:
         | I've used pv longer than dd had this option for, but that's
         | fair! I also don't use find options, for example, since find
         | piped into the tool everyone already knows anyway - grep - is
         | much easier
         | 
         | Sadly, dd will not give you an estimated time or allow you to
         | limit the transfer rate, which are two features I use a lot in
         | pv
        
         | fuzztester wrote:
         | dd conv=swab is a cool and useful option. swab stands for swap
         | bytes, iirc. guess what it is used for, those who don't already
         | know.
        
       | darkwater wrote:
       | Pipe viewer? What's that? Let me check the post...oh, it's good
       | old pv! Never noticed it had a full name, damn Unix utilities
       | with their short names!
        
         | fuzztester wrote:
         | There is a shell built-in called alias.
         | 
         | You can use it to map the short name to the long name if you
         | prefer, although people usually do it the other way around, to
         | save on typing.
         | 
         | ;)
        
       | ElevenLathe wrote:
       | See also vipe(1) from the wonderful moreutils:
       | https://manpages.debian.org/stretch/moreutils/vipe.1.en.html
        
       | sirjaz wrote:
       | We have that in powershell also show-progress
        
         | gerdesj wrote:
         | Ah yes, PowerShell. Never have so many owed so much to ... tab
         | completion 8)
        
       ___________________________________________________________________
       (page generated 2024-11-20 23:01 UTC)