I've installed some utilities from the CLI and got quite a long verbose output describe what was installed directly, what needed some dependencies, what is no longer needed to be installed, etc.

Is there a way to grep something from this last command ? A very certain word I need.


  • 1
    why dont you redirect the output to some files and grep your words from that file ? – Kamaraj Dec 27 '16 at 1:30
  • That sounds good @Kamaraj, I would like to redirect it to a temporary file, then cat the file with a pipe, then grep the desired word. – JohnDoea Dec 27 '16 at 1:44
  • cat filename | grep "pattern" ...... grep itself can read the file.... so you can use like grep "pattern" filename.. if you use cat and grep, then you will get a "useless use of cat award" ( google it ) – Kamaraj Dec 27 '16 at 1:46
'your install command' > /tmp/out.txt 2>&1

then, use the /tmp/out.txt to grep the required patterns

grep "pattern" /tmp/out.txt

Redirect stderr to stdout (&1), and then redirect stdout to a file:

'your install command' > /tmp/out.txt 2>&1
  • Thanks. Can yu please an appendix at the end of the answer with an explanation about 2>&1? Seems to me like "append to a file descriptor different then 0 or 1, which is 2, and run in the background". I don't know what is 1 in the very end. – JohnDoea Dec 27 '16 at 2:14
  • its not about running background.. please refer this link – Kamaraj Dec 27 '16 at 2:20

I needed something that does that after I ran the installation command, and not for to-come installation commands.

While I don't know a command to do it after the instillation command has been executed, what I did was to copy the output from Bash itself, into a text editor like Vi or Nano, and then search for all instances of the desired phrase.


The information might be in the log files of apt.

grep -Ri "pattern" /var/log/apt/*log

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.