Enabling, disabling camera from terminal

How do I enable and disable the laptop's camera from the terminal? And how will I know if it is on or of?


Press Ctrl+Alt+T on your keyboard to open the terminal.

When it opens, run command to disable the camera until reboot:

sudo modprobe -r uvcvideo

You will be asked for your password, and after typing it, if there are no errors shown in the terminal, your webcam should be disabled.

To enable your webcam again, run:

sudo modprobe uvcvideo

As a complement to @Otto answer, you also asked how to check whether the camera is actually disabled or not. In order to do so you can check if the module is loaded or not using lsmod which shows the status of modules in the Linux kernel.

The module you disables in @Otto's answer is uvcvideo, therefore, you can check if it is loaded like this:

lsmod | grep uvcvideo

The output should be similar to this when the module is enabled:

uvcvideo               98304  0
videobuf2_vmalloc      20480  1 uvcvideo
videobuf2_v4l2         24576  1 uvcvideo
videobuf2_common       49152  2 videobuf2_v4l2,uvcvideo
videodev              225280  3 videobuf2_v4l2,uvcvideo,videobuf2_common
mc                     53248  4 videodev,videobuf2_v4l2,uvcvideo,videobuf2_common

And when it is disabled no occurrences to uvcvideo should be returned from the command.