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

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
5
down vote

favorite












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



It looks like this:



up() 
emulate -LR zsh
[[ -d "$HOME/log" ]]


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.



One of the commands executed by __update_system is:



$ 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.



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.



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:



$ 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?










share|improve this question

























    up vote
    5
    down vote

    favorite












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



    It looks like this:



    up() 
    emulate -LR zsh
    [[ -d "$HOME/log" ]]


    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.



    One of the commands executed by __update_system is:



    $ 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.



    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.



    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:



    $ 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?










    share|improve this question























      up vote
      5
      down vote

      favorite









      up vote
      5
      down vote

      favorite











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



      It looks like this:



      up() 
      emulate -LR zsh
      [[ -d "$HOME/log" ]]


      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.



      One of the commands executed by __update_system is:



      $ 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.



      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.



      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:



      $ 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?










      share|improve this question













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



      It looks like this:



      up() 
      emulate -LR zsh
      [[ -d "$HOME/log" ]]


      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.



      One of the commands executed by __update_system is:



      $ 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.



      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.



      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:



      $ 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?







      command-line apt package-management updates






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Sep 13 at 12:33









      user938271

      1313




      1313




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          8
          down vote



          accepted











          • apt-file is a perl script.

          • It uses diffindex-download. That is another perl script.

          • That one writes to /dev/tty and not to stdout (the difference is explained on this SO answer)


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



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






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "89"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1074936%2fhow-to-redirect-the-output-of-apt-file-update-into-a-file%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            8
            down vote



            accepted











            • apt-file is a perl script.

            • It uses diffindex-download. That is another perl script.

            • That one writes to /dev/tty and not to stdout (the difference is explained on this SO answer)


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



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






            share|improve this answer
























              up vote
              8
              down vote



              accepted











              • apt-file is a perl script.

              • It uses diffindex-download. That is another perl script.

              • That one writes to /dev/tty and not to stdout (the difference is explained on this SO answer)


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



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






              share|improve this answer






















                up vote
                8
                down vote



                accepted







                up vote
                8
                down vote



                accepted







                • apt-file is a perl script.

                • It uses diffindex-download. That is another perl script.

                • That one writes to /dev/tty and not to stdout (the difference is explained on this SO answer)


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



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






                share|improve this answer













                • apt-file is a perl script.

                • It uses diffindex-download. That is another perl script.

                • That one writes to /dev/tty and not to stdout (the difference is explained on this SO answer)


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



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







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Sep 13 at 12:51









                Rinzwind

                198k25380512




                198k25380512



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1074936%2fhow-to-redirect-the-output-of-apt-file-update-into-a-file%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?