Article 4TEWB clarification w/r/t directing sudo output to flash drive

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.latest?d=yIl2AUoC8zA latest?i=HsoHdVMZDgU:at-AmsYV91w:F7zBnMy latest?i=HsoHdVMZDgU:at-AmsYV91w:V_sGLiP latest?d=qj6IDK7rITs latest?i=HsoHdVMZDgU:at-AmsYV91w:gIN9vFwHsoHdVMZDgU
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments