How to get command output of “nvidia-settings” via command line?

3

the case at hand:

nvidia-settings -q all | grep 'Attribute.*GPUCoreTemp'

gives:

Attribute 'GPUCoreTemp' (system5:0.0) 58.                              
Attribute 'GPUCoreTemp' (system5:0[gpu:0]): 58. 

then I make it:

nvidia-settings -q all | grep 'Attribute.*GPUCoreTemp' |  sed -e 's/.* //'

gives me:

58.

58.

But I only want the first one... How to achieve this?

Ashrael

Posted 2015-12-14T18:23:23.833

Reputation: 31

Answers

2

Pass grep the -m 1 switch, to limit to only one matching output. See man grep.

tniles

Posted 2015-12-14T18:23:23.833

Reputation: 209

Life can be soooo simple :) thx! I always get lost in man pages somehow, esp. the long ones. – Ashrael – 2015-12-14T18:34:13.743

No problem, and glad to help! :-) Please accept my answer if this worked for you. – tniles – 2015-12-14T18:40:02.763

1

Use -t query option

$ nvidia-settings -t -q [gpu:0]/GPUCoreTemp
56

hobbyte

Posted 2015-12-14T18:23:23.833

Reputation: 11