> $ gzip -c access.log > access.log.gz
Is it?
> $ gzip -c access.log > access.log.gz
Is it?
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
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).
tar ... | dd status=progress | ...
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
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.
;)
Changing the endianness of the data?
It has a limit parameter so you can limit the speed. Great if you don't want to saturate some link or have additional costs for uploading above a certain rate per hour/day.
Also useful for testing behaviour on slow filesystem / connections.
It can take a pid argument too, -d IIRC, which will get it to display progress info for all the open file descriptors of a running process.
Really useful as a quick way to check what a IO process is doing if appears to be stuck.
Also does pv necessitate doing single threaded I/O?
Fun stuff! Especially when combined with GNU parallel, in cases where the thing I'm measuring isn't already parallelized, and I want to be lazy.
That's just what I used it for, early in my career, in a software troubleshooting case.
I was a newbie dev, tasked with converting some data from another machine / OS format on tape to a Unix machine format.
Was fairly new to Unix too.
Looked through man pages, found dd, could read and copy the data from tape drive to disk using it. But the data, while in ASCII, and English letters, seemed garbled. Seemed like actual words, but not quite, if you know what I mean. Something seemed off a bit.
I puzzled over it for a while, then checked the dd man page again. I saw the conv=swab option and its meaning, which is to swap adjacent bytes. (Typical Unix cryptic syntax, and I say that as a long term Unix guy). I probably was new to endianess at that time. This was in a pre-Internet time, so I could not google to check what endianness meant.
I added that option to my dd command line, and what was my shock and pleasure to see all the words coming out as proper English words, now, on the screen!
Then I knew that the tape contained actual data, not garbage. I saved it to disk under some file name.
Job done.
tar -cz dir | base64
Copy output into clipboard base64 -d | tar -xz
Paste from clipboard into inputWorks flawlessly to move configs and stuff between servers.
I actually love the blend between terminal and GUI. For this example I'm using CLI tools to produce text and I'm using GUI to scroll, select and copy&paste the text between two terminal tabs. I wish developers put more emphasis on empowering terminal with GUI capabilities.
Searching now it seems indeed that up until recently this was a problem other people have been having too. For example the recent forum thread https://forums.freebsd.org/threads/zfs-send-hanging.94994/ where they were discussing which version this was fixed in and someone saying that the latest available version to them from the packages was still a bit too old.
No you cannot:
1. Compression algorithms buffer a lot and will have have tendencies to perform large burst writes and in particular large writes on final flush. Instantaneous measurements will therefore not be particularly useful.
2. Compression ratio refers to the average across an entire file, as entropy is not uniform across the input unless you are compressing just noise or just zeros. Some sections might compress extremely well while others do not and end up consuming more space than the input due to overhead.
$ echo "ehll,ow rodl" | dd conv=swab
# Should give:
hello, world
A bit like rot13, but with 2 as the length :)
Yeah, but that’s exactly the case where it won’t work. pbcopy and pbpaste run locally, so if you’re connected to a remote Mac they won’t work properly (they will just cut/paste to the remote machine’s local pasteboard), and if you’re connected to a non-Mac the commands won’t exist at all. The only case where they would work is, say, connecting from one Mac to another via something like VNC that does do pasteboard sharing, and you’re trying to copy a file structure from a remote system to a local one. If you’ve got two terminal windows open to two different machines, you’ll have to cut and paste manually.