I know how to view the current processes on my Ubuntu machine. For example, I can leave a ping running:

ping localhost

Then do:

$ ps -ef | grep ping

Which shows:

user1      2875    1231  0 Feb08 ?        00:00:03 /usr/libexec/gsd-housekeeping
user2     96834   43257  0 14:21 pts/4    00:00:00 ping localhost
root       96837   63560  0 14:21 pts/1    00:00:00 grep --color=auto ping

But what about the host command? I left it running in a loop:

for i in {1..50000}; do host localhost; done

Then do:

$ps aux | grep host

But all I get is:

root       98021   63560  0 14:24 pts/1    00:00:00 grep --color=auto host

Yes, I even tried as root! Of course, I can see the name resolver, but that's always on:

$ ps -ef | grep resolv
systemd+    1015       1  0 Feb08 ?        00:00:17 /lib/systemd/systemd-resolved

Should I not also see host from /usr/bin/host?

By the way, same thing with ls. I know these commands are sort of special, kind of "built-in", but I thought they would be treated like any other process? Unlike cd there's an actual executable. I ran strace on it:

execve("/usr/bin/host", ["host", "localhost"], 0x7ffdf51ee518 /* 58 vars */) = 0
brk(NULL)                               = 0x559cc809a000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffd20032c70) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)

Don't see anything that would explain it. What am I missing?! Thank you for helping to improve my understanding!

1 Answer 1


The ping runs once: it has its own internal timer to repeat the task, but the same process stays there until the count expires, or you kill it, depending on options.

Host is an external command, not a shell built-in, so this is nothing to do with sub-processes. But it runs to completion 50,000 times. The probability of it being in the process table when ps | grep is looking for it is probably 1%. If you run the ps in a loop too, you might see a few hits eventually. It's possible with two diagnostic processes running, the creation of host process might never synchronise with the ps because of some scheduler constraint.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .