How to detect if Kali is run from Live CD in Bash?

0

What is the most reliable way to detect if Kali is run from Live CD or installed to disk?

Steve Clement

Posted 2019-02-13T12:32:43.163

Reputation: 1

Answers

0

One way would be to do:

root@kali:~# df -kh |grep live
/dev/sr0        3.0G  3.0G     0 100% /run/live/medium
/dev/loop0      2.7G  2.7G     0 100% /run/live/rootfs/filesystem.squashfs
tmpfs           5.8G   24M  5.8G   1% /run/live/overlay

This works because live-boot is being used as a basis for the Live USB disc.

More info can be found here: https://manpages.debian.org/testing/live-boot-doc/live-boot.7.en.html This also explains the overlay shim.

Steve Clement

Posted 2019-02-13T12:32:43.163

Reputation: 1

1While this may answer the question, it would be a better answer if you could provide some explanation why it does so. – DavidPostill – 2019-02-13T12:49:21.240

Ok, good idea I will integrate that into the answer. – Steve Clement – 2019-02-16T12:04:05.247