I want to compare the list of packages in a computer with an authorized list that I have. How would I do that? Would the following work?
cd /home
touch authorizedlist.txt
(list contents) >> authorizedllist.txt
touch currentlist.txt
dpkg -l | cut -d ' ' -f3 | less >> currentlist.txt
touch difflist.txt
diff authorizedlist.txt currentlist.txt >> difflist.txt
Is there a way to both create a new text file and add contents to it in one command instead of doing touch then putting the text in? Also, is there a way to only print what is unneeded from the currentlist and not what is missing from it?