Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use commands to take screenshots under Linux graphical interface

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to use commands to take screenshots under the Linux graphical interface". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

In the past, screenshots in LINUX were taken by directly pressing the print screen key or alt + print screen.

But print screen is the whole screen, and alt + print screen is the current window.

What do you want to use to capture an area of the screen?

The answer is the import command, enter:

The code is as follows:

$import ddd.jpg

Then the mouse will become "+", just like the screenshot tool of QQ, it is convenient to OK as soon as you drag it.

Screenshot of login interface

In daily use, we take screenshots after logging in to the system, such as capturing a window, a specified area, or an entire web page. It's a bit complicated to take a screenshot of the login interface, which is what you need to do before you log in.

Use these commands to capture a screenshot of the login interface under root permissions:

The code is as follows:

Chvt 8

Sleep 5

DISPLAY=:0.0 XAUTHORITY=/var/lib/mdm/:0.Xauth xwd-root > / tmp/shot.xwd

Convert / tmp/shot.xwd / tmp/ss.png

The most critical part of these commands is the third line of XAUTHORITY=/var/lib/mdm/. Different distributions use different login managers by default. For example, Ubuntu uses lightdm,Kubuntu, kdm,Linux Mint uses mdm, and distributions with Gnome as the desktop environment use gdm.

The corresponding XAUTHORITY is different for different login managers. So among the materials found on the Internet, some are XAUTHORITY=/var/run/lightdm/root/, and some are XAUTHORITY=/var/lib/gdm/. So the question is, how do we determine which login manager is used by the current system?

Of course, you can't pat the head, you have to have a reason. At first, I used to think that the dm I was using was kdm, but I fell into the pit.

In fact, it is very simple, you only need to take a look at the process whose name contains dm, and you can determine how to write the command.

This is the end of the content of "how to use commands to take screenshots under the Linux graphical interface". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers