How to redirect the output of `apt-file update` into a file?

How to redirect the output of `apt-file update` into a file?



I have a zsh function which updates my system (.deb packages, pip packages, texlive packages, ...).


.deb


pip



It looks like this:


up()



The last line calls the __update_system function and pipes its output to tee, which in turn should display the output on the terminal, and append it to a file, so that I can review it later if something went wrong.


__update_system


tee



One of the commands executed by __update_system is:


__update_system


$ apt-file update



It seems to be executed, but its output is not logged in the file.
All the other commands (including aptitude update) are logged.


aptitude update



I tried to understand by executing this command in a shell:


$ apt-file update >/tmp/log



Again, apt-file update seems to be executed, but the output is not logged as /tmp/log is empty.


apt-file update


/tmp/log



I thought that maybe the output is sent on the standard error, so I tried:


$ apt-file update >/tmp/log 2>&1



But I got the same result, an empty file.



I tried in bash, which also gave me an empty file.



Here are some details about my system:


$ uname -a
Linux ubuntu 4.4.0-135-generic #161-Ubuntu SMP Mon Aug 27 10:45:01 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux



About zsh:


$ zsh --version
zsh 5.5.1-dev-0 (x86_64-pc-linux-gnu)



About bash:


$ bash --version
GNU bash, version 4.4.0(1)-release (x86_64-unknown-linux-gnu)



About apt-file:


apt-file


$ aptitude show apt-file
Package: apt-file
State: installed
Automatically installed: no
Version: 2.5.5ubuntu1
Priority: optional
Section: universe/admin
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: all
Uncompressed Size: 92,2 k
Depends: perl, curl, libconfig-file-perl, libapt-pkg-perl, liblist-moreutils-perl, libregexp-assemble-perl,
libfile-temp-perl
Suggests: openssh-client, sudo
Description: search for files within Debian packages (command-line interface)
apt-file is a command line tool for searching files contained in packages for the APT packaging system. You can search
in which package a file is included or list the contents of a package without installing or fetching it.



How to redirect the output of apt-file update into a file?


apt-file update




1 Answer
1


apt-file


/dev/tty


stdout



Soooo... this will log the output to logfile.log


logfile.log


script -c "apt-file update" logfile.log



Thanks for contributing an answer to Ask Ubuntu!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)