3 ms·
Let's count for your example. In all cases, I'll exclude the actual name of the file. We type in the first command: cat file | less less file The se
by swolchok 17y ago
Let's count for your example. In all cases, I'll exclude the actual name of the file. We type in the first command:
cat file | less
less file
The second version is 5 fewer keystrokes. On to the next command:
cat file | grep thing
grep thing !$
The second example is the same or fewer keystrokes. In both cases, you have to type "grep thing". In the first, you have to press the up arrow and backspace over "less" (at least three keystrokes), and in the second, you have to type an extra " !$".
I'll skip moving to "cat file | grep otherthing" or "grep otherthing !$", and consider the change to get to
cat file | grep otherthing | cut stuff
grep otherthing file | cut stuff
In both cases, you have to type " | cut stuff". If you key in the second example as "!! | cut stuff", that's an extra two keystrokes. If you key in the first as up arrow + "| cut stuff", that's only 1 extra keystroke.
In total, my version saves keypresses in the specific example and doesn't seem much worse in general.