Search code examples
linuxcommanddebianpipeapt

Using the apt list command to output to a file (Debian)


I want to take the entire list that generates from the apt list command and save or view it in a file. Either in nano or some form of a text editor. I thought of piping results into a file, any help would be appreciated, Thank You!


Solution

  • As updated to specfic sceniro The quick solution is to use

    apt list | awk '{print $1}' | tee a.txt
    

    where a.txt is the file name.

    The above command simply pipe the output from awk to tee command which report to cli as well as write to file