Get information on your graphics card on linux (such as graphics memory size)

for I in `/sbin/lspci |awk '/VGA/{print $1}'`;do /sbin/lspci -v -s $I;done
Loop is needed if you have more then one card.
Sample Output
01:00.0 VGA compatible controller: nVidia Corporation G84 [GeForce 8600 GT] (rev a1) (prog-if 00 [VGA controller])
	Subsystem: ASUSTeK Computer Inc. Device 8243
	Flags: bus master, fast devsel, latency 0, IRQ 16
	Memory at f9000000 (32-bit, non-prefetchable) [size=16M]
	Memory at c0000000 (64-bit, prefetchable) [size=256M]
	Memory at f6000000 (64-bit, non-prefetchable) [size=32M]
	I/O ports at ac00 [size=128]
	[virtual] Expansion ROM at f8fe0000 [disabled] [size=128K]
	Capabilities: <access denied>
	Kernel driver in use: nvidia

02:00.0 VGA compatible controller: nVidia Corporation G84 [GeForce 8600 GT] (rev a1) (prog-if 00 [VGA controller])
	Subsystem: ASUSTeK Computer Inc. Device 8243
	Flags: bus master, fast devsel, latency 0, IRQ 16
	Memory at fd000000 (32-bit, non-prefetchable) [size=16M]
	Memory at d0000000 (64-bit, prefetchable) [size=256M]
	Memory at fa000000 (64-bit, non-prefetchable) [size=32M]
	I/O ports at bc00 [size=128]
	[virtual] Expansion ROM at fe7e0000 [disabled] [size=128K]
	Capabilities: <access denied>
	Kernel driver in use: nvidia

4
By: houghi
2010-10-26 19:02:26

1 Alternatives + Submit Alt

  • probably only works if you have one graphics card. used this: http://www.cyberciti.biz/faq/howto-find-linux-vga-video-card-ram/ as reference can be expanded, for example: lspci -v -s `lspci | awk '/VGA/{print $1}'` | sed -n '/Memory.*, prefetchable/s/.*\[size=\([^]]\+\)\]/\1/p' will just get the amount of prefetchable memory compare to: lshw -C display which does not give the size (it does give byte ranges and you could calculate the size from that, but that's a pain) Also uses a command which is not standard on linux; wheras lspci is a core utility provided by most systems Show Sample Output


    1
    lspci -v -s `lspci | awk '/VGA/{print $1}'`
    infinull · 2010-10-26 17:45:14 0

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: