Running Linux Shell Commands and Variables in LabVIEW

Updated Feb 11, 2026

Reported In

Software

  • LabVIEW

Operating System

  • Linux

Issue Details

I am writing a LabVIEW code for my Linux machine, and I would like to use the outputs of shell commands and environmental variables in the code. How can I access the outputs of these commands and variables?

Solution

You can send commands to be executed on a terminal in LabVIEW by using the System Exec VI. Enter the terminal command as a string into the command line input of the System Exec VI. The output can then be used as needed.
 

Additional Information

Below is an example of using the System Exec VI to output driver messages relating to the system's serial ports.

 

More specifically, the [External] dmesg command is used to print a message buffer of the kernel. The output of dmesg is redirected to the input of the [External] grep command using the [External] Pipe character (|). The grep command allows for searching of patterns inside strings and files. In this case, we are searching for the string pattern ttyS.

 

The expected output will vary depending on whether your message buffer includes a ttyS string. If so, this section of the message buffer will be printed. If not, the output will be empty.