Q:

how to display version only of Visual Studio Code

On a VM running Ubuntu 18.04 Visual Studio Code is installed.  When code --version is executed on the command line, the follow info is outputted in the terminal:
knot22@juniper:~/Desktop/pile$ code --version
1.40.2
f359dd69833dd8800b54d458f6d37ab7c78df520
x64

Is there a command that will limit the output only to the version so just 1.40.2 is outputted?
I want just the version number, not all of the data outputted by --version for the code package.

A:

You can simply use head command like that
code --version | head -1

You would get :
knot22@juniper:~/Desktop/pile$ code --version | head -1
1.40.2
knot22@juniper:~/Desktop/pile$

Little explanation : 

head -number_lines would display the first number_lines, so in your case, it would display just the 1rst line due to -1 option (e.g -3 would display 3 lines)

