0

I tend to prefer shell over term. With shell everything is text and I can use the Emacs bindings to move around.

Also, I have been trying to avoid opening my nixOS terminal. I have been trying to stay in Emacs as much as I can. However, executing htop on *shell* does not work. The image below shows what I get:

enter image description here

I was expecting what is been retrieved by the *terminal* buffer.

enter image description here

I feel I do not really understand terminal emulators in Emacs.

Why htop does not work in *shell*? Is there a way to fix this by tweaking my config file?

1
  • 2
    htop uses cursor-motion character sequences to place everything exactly where it wants. term interprets those characters as cursor motions and everything works; shell does not: it just inserts them into the buffer. IOW, shell provides only a "dumb" terminal that does not know how to interpret ANSI terminal escape sequences.
    – NickD
    May 14 at 0:37

2 Answers 2

1

M-x term is a terminal emulator. htop needs a terminal.

M-x shell is only a shell, not a full terminal. Shell commands like ps will work but terminal commands like htop or vim will not.

I agree that shell is more convenient because it's just text, but you'll need a terminal to run terminal commands. When I do need a terminal, I use vterm over term but it's still inconvenient compared to shell.

2

@NickD and @amitp answers are the correct ones making a distinction between shell and term.

As a side note, proced built-in command in Emacs is a good alternative for htop. But this point is unrelated to the terminal/shell discussion.

1
  • 2
    I agree that proced is the right tool for the job!
    – aadcg
    May 15 at 15:12

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.