Take screenshots from the command line in Linux

本文介绍如何使用Linux命令行工具进行截图,包括使用import选择区域截图及利用scrot进行全屏截图、延时截图等高级功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

There are many Linux applications dedicated to taking screenshots. However, you minght want to use the command line to do this, either because you want to build an automated script, or because you have a terminal screen handy.

import screenshot.jpg

This will allow you to select a rectangle using your mouse. The moment you let go of your left mouse button, a screenshot with the contents of that rectangle will be saved in the current directory.
And then there’s scrot.

scrot -d 4 screenshot.png

This will take a screenshot of your entire desktop, with a delay of 4 seconds between launching the command and saving the screenshot.png file. Use

scrot -c -d 4 screenshot.png

to also display a countdown in the console. Use

scrot -q 80 -c -d 4 screenshot.jpg

to save a JPG file with a quality of 80%.
You can also use special strings with scrot, as to produce filenames that contain the date and size of the screenshot:

scrot ‘%Y-%m-%d_$wx$h.png’ -e ‘mv $f ~/Desktop/Pictures/’

The command above will produce a file named 2010-11-28_2560×1024.png on my system and move that file to to a folder called Pictures, residing on my desktop.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值