home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] is "xargs" really still useful just for limiting command line size?

On Fri, 16 Mar 2018, J C Nash wrote:

This may introduce a tangent, but I find the limit is often not the
coded one but issues related to
- getting 250 characters into the line and not remembering whether the
  parameter should be X or x and what the difference is.

Indeed.

For those who may not be familiar, "<Esc>#" is a useful key combo in bash for this situation. I was delighted to discover it.

It immediately puts a "#" comment character at the start of your line then submits it as if you had pressed enter. The incomplete command is then in your command line buffer as a comment. You can look up the missing info you need, then retrieve your command line using the Up arrow key or ^R, then carry on completing and submitting it after deleting the "#".

Kind of like a ^Z suspend for the command line.

Shell (bash) processing, including application argument parsing and completion, and easy handling of filenames with spaces in by starting them with a quote has *really* advanced over the decades. In my opinion command line has made more useful progress than graphical interfaces in the past 20 years.

I was really blown away when I accidently discovered that scp does command line (e.g. filesystem path) completion on the *remote* host! e.g. hit <tab> as you enter a filesystem path and it can show options or complete it, just as if it was your local host. You need to have key-based, not password, authentication on the remote system for this to work, obviously.

As for xargs (almost always with -0) I use it all the time. It allows me to pipe multiple commands together is a consistent manner that always works, so less thinking. :-)

Brett