Before Installation of KVM we have to check our processor support visualization or not and we run a command i.e:
egrep -c '(vmx|svm)' /proc/cpuinfoWhich gives output 0/1/2/3/4 depends on processor
if 0 then not support visualization else it support.
Anyone please explain the command i.e. what egrep -c (vmx|svm) stands for ??
Thanks in advance.
1 Answer
egrep -c '(vmx|svm)' /proc/cpuinfoThis searches if one of those two flags exist in the /proc/cpuinfo file.
SVM is flag related to the AMD virtualization (AMD-V). The CPU flag for AMD-V is "svm".
VMX is falg related to the Intel virtualization (VT-x). The CPU flag for VT-x capability is "vmx";
man egrep
NAME grep, egrep, fgrep, rgrep - print lines matching a pattern
DESCRIPTION grep searches the named input FILEs (or standard input if no files are named, or if a single hyphen-minus (-) is given as file name) for lines containing a match to the given PATTERN. By default, grep prints the matching lines. In addition, three variant programs egrep, fgrep and rgrep are available. egrep is the same as grep -E.then egrep is same as gerp -E which means also from man grep
-E, --extended-regexp Interpret PATTERN as an extended regular expression So in conclusion this will search the file /proc/cpuinfo for those cpu flags and then count the occurrence instead of printing the matching it counts matching number.
-c, --count Suppress normal output; instead print a count of matching lines for each input file.