emacsorg-modeorg-babel

Capture output from a shell command with babel in org-mode


I want to know about my networking hardware.

lspci | grep -i net

From the terminal, this command gives the following output:

00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 06) 02:00.0 Network controller: Intel Corporation Centrino Advanced-N 6200 (rev 35)

But when I try running this from org-mode through a babel source block I get no output.

#+BEGIN_SRC sh
lspci | grep -i net
#+END_SRC

#+RESULTS:

What gives? How can I get the same output I got from the terminal?


Solution

  • You do get results, only not handled properly (most likely temporarily displayed in the minibuffer).

    Add :results output replace after #+begin_src sh, as a header argument (to override default values), to have the output (re)placed in your org-mode buffer. All its possible values are described here in the Manual.