Is someone using my webcam?
It’s no secret that attackers can activate a webcam without the owner’s knowledge. In response, some laptop manufacturers have started adding physical privacy shutters or LED indicators. You can also buy stick-on covers, or just use a piece of tape: cheap and effective. But if you want to know whether your webcam is in use right now, there’s a simple way to check.
Problem: Some webcams have no indicator light, making it impossible to tell if they’re active.
Check on Linux
Run this command in the terminal:
lsof /dev/video*
It lists the processes that have a video device open. If there’s no output, the webcam is not in use. To see how it works, open a video app like Skype with the camera enabled and run the command again: this time you’ll see the app in the output. Run it with sudo to also see processes of other users.
You can also check one device directly:
fuser /dev/video0
If the device is in use, the PID of the process using it is printed. Then ps -p PID -o comm= shows the name of that program.
The older variant lsof | grep video gives the same answer, but it lists every open file in the system first, so it is much slower.
What about macOS?
On macOS, cameras are not exposed as /dev/video devices, so these commands don’t apply. MacBooks and iMacs have a green indicator next to the camera that is wired to the camera hardware, so it lights up whenever the camera is on. To see which apps are allowed to use the camera, check the Camera section in System Preferences → Security & Privacy → Privacy.