This is hackish.
I sometimes need to quickly run programs one after the other in the terminal with some commands needing sudo while others do not, such as:
$ command1; c2; sudo c3 | c4; c5 | sudo c6; c7; sudo c8
I would like to initiate sudo (aka type the password) before command1 so that there will be no bottleneck in c3 waiting for the password.
Most of the time, I initiate sudo using a random command I haphazardly typed in the keyboard, like:
$ sudo laksdfjlskjf; command1; c2; sudo c3 | c4; c5 | sudo c6; c7; sudo c8
It says command not found for laksdfjlskjf, but I've successfully done what I need to do: initiate sudo. No bottleneck in c3.
Question:
Is there a better way than typing (non-)random characters to initiate sudo? Is there a safe command that does nothing and so is safe to use sudo on?