htop lists each thread of a process separately, while
ps doesn't. Turn off the display of threads, press
H, or use the “Setup / Display options” menu, “Hide userlands threads”. This puts the following line in your
~/.config/htop/htoprc (you can alternatively put it there manually):
hide_kernel_threads=1, toggled by pressing
K, but it's 1 by default.)
Another useful option is “Display threads in a different color” in the same menu (
.htoprc), which causes threads to be shown in a different color (green in the default theme).
In the first like of the
htop display, there's a line like “Tasks: 377, 842 thr, 161 kthr; 2 running”. This shows the total number of processes, userland threads, kernel threads, and threads in a runnable state. The numbers don't change when you filter the display, but the indications “thr” and “kthr” disappear when you turn off the inclusion of user/kernel threads respectively.
When you see multiple processes that have all characteristics in common except the PID and CPU-related fields (NIce value, CPU%, TIME+, …), it's highly likely that they're threads in the same process.