clarification w/r/t directing sudo output to flash drive
by frankfenderbender from LinuxQuestions.org on (#4TEWB)
I am on a dell Precision 5820 running Ubuntu 18.04 (on sda) with Linux 4.x kernel.
I am step-wise saving-off the grub configurations before and after adding new OSs to internal hard drives.
My current state is Ubuntu only.
I am saving off the following to a sandisk 32G flash drive:
pillbug-ubuntu/
pillbug-ubuntu/etc/
pillbug-ubuntu/etc/default/
pillbug-ubuntu/etc/default/grub
pillbug-ubuntu/etc/grub.d/
pillbug-ubuntu/etc/grub.d/*_custom
pillbug-ubuntu/boot/
pillbug-ubuntu/boot/grub/
pillbug-ubuntu/boot/grub/grubenv
pillbug-ubuntu/boot/grub/grub.cfg
I am on the flash drive (set by `sudo chmod -Rf 777') in its /media/A061-BC1F/pillbugadm/ubuntu-apt directory.
$ ls -al
drwxr-xr-x root root .
drwxr-xr-x root root ..
I have tried all these command-line renditions:
$ history 2000 | grep "apt" > ./apt_history2000
$ sudo history 2000 | grep "apt" > ./apt_history2000
$ history 2000 | sudo grep "apt" > ./apt_history2000
$ sudo history 2000 | sudo grep "apt" > ./apt_history2000
I get output/write permission errors in all cases.
bash: apt_history2000: Permission denied
I finally tried to create the file, change its permissions, and then ">>" to it:
$ sudo touch ./apt_history2000
$ sudo chmod -f 777 ./apt_history2000
These both were successful.
However, I am right (or is that "write") back with the same "permission denied" problem when trying all of the following:
$ history 2000 | grep "apt" >> ./apt_history2000
$ sudo `history 2000 | grep "apt"` >> ./apt_history2000
$ sudo `history 2000 | sudo grep "apt" >> ./apt_history2000`
$ (sudo history 2000 | grep "apt") >> ./apt_history2000
$ sudo (history 2000 | grep "apt" >> ./apt_history2000)
$ history 2000 >> ./apt_history2000
$ echo "wtf" >> ./apt_history2000
Any 'blind-spots' (by me) found by you, or command/media 'work-around' suggestions, are greatly appreciated. I have no problems using most of thse basics with a USB HD. I am beginning to have a foul taste in my throat w/r/t flash drive's supposed "high-tech"-ness.
Thanks.


I am step-wise saving-off the grub configurations before and after adding new OSs to internal hard drives.
My current state is Ubuntu only.
I am saving off the following to a sandisk 32G flash drive:
pillbug-ubuntu/
pillbug-ubuntu/etc/
pillbug-ubuntu/etc/default/
pillbug-ubuntu/etc/default/grub
pillbug-ubuntu/etc/grub.d/
pillbug-ubuntu/etc/grub.d/*_custom
pillbug-ubuntu/boot/
pillbug-ubuntu/boot/grub/
pillbug-ubuntu/boot/grub/grubenv
pillbug-ubuntu/boot/grub/grub.cfg
I am on the flash drive (set by `sudo chmod -Rf 777') in its /media/A061-BC1F/pillbugadm/ubuntu-apt directory.
$ ls -al
drwxr-xr-x root root .
drwxr-xr-x root root ..
I have tried all these command-line renditions:
$ history 2000 | grep "apt" > ./apt_history2000
$ sudo history 2000 | grep "apt" > ./apt_history2000
$ history 2000 | sudo grep "apt" > ./apt_history2000
$ sudo history 2000 | sudo grep "apt" > ./apt_history2000
I get output/write permission errors in all cases.
bash: apt_history2000: Permission denied
I finally tried to create the file, change its permissions, and then ">>" to it:
$ sudo touch ./apt_history2000
$ sudo chmod -f 777 ./apt_history2000
These both were successful.
However, I am right (or is that "write") back with the same "permission denied" problem when trying all of the following:
$ history 2000 | grep "apt" >> ./apt_history2000
$ sudo `history 2000 | grep "apt"` >> ./apt_history2000
$ sudo `history 2000 | sudo grep "apt" >> ./apt_history2000`
$ (sudo history 2000 | grep "apt") >> ./apt_history2000
$ sudo (history 2000 | grep "apt" >> ./apt_history2000)
$ history 2000 >> ./apt_history2000
$ echo "wtf" >> ./apt_history2000
Any 'blind-spots' (by me) found by you, or command/media 'work-around' suggestions, are greatly appreciated. I have no problems using most of thse basics with a USB HD. I am beginning to have a foul taste in my throat w/r/t flash drive's supposed "high-tech"-ness.
Thanks.