Python + bash
Если вам часто требуется запускать shell команды из Python-кода, какой способ вы используете?
Самый низкоуровневый это функция os.system(), либо os.popen(). Рекомендованный способ это subprocess.call(). Но это всё еще достаточно неудобно.
Советую обратить своё внимание на очень крутую библиотеку sh.
Что она умеет?
🔸 удобный синтаксис вызова команд как функций
# os
import os
os.system("tar cvf demo.tar ~/")
# subprocess
import subprocess
subprocess.call(['tar', 'cvf', 'demo.tar', '~/'])
# sh
import sh
sh.tar('cvf', 'demo.tar', "~/")
🔸 простое создание функции-алиаса для длинной команды
fn = sh.lsof.bake('-i', '-P', '-n')
output = sh.grep(fn(), 'LISTEN')
в этом примере также задействован пайпинг
🔸 удобный вызов команд от sudo
with sh.contrib.sudo:
print(ls("/root"))
Такой запрос спросит пароль. Чтобы это работало нужно соответствующим способом настроить юзера.
А вот вариант с вводом пароля через код.
password = "secret"
sudo = sh.sudo.bake("-S", _in=password+"\n")
print(sudo.ls("/root"))
Это не все фишки. Больше интересных примеров смотрите в документации.
Специально для Windows💀 юзеров
#libs#linux
📰 Proton Experimental brings fixes for Crimson Desert, Steam Overlay with EA games, Death Stranding 2
Valve just pushed out another excellent update for Proton Experimental - further improving Windows games running on Linux / SteamOS.Read the full article on GamingOnLinux.
🔗 Source: https://www.gamingonlinux.com/2026/03/proton-experimental-brings-fixes-for-crimson-desert-steam-overlay-with-ea-games-death-stranding-2/
#steam#linux
📰Steam Linux Beta Prepares For 64-bit, Can Be Run Inside Steam Runtime Container
An interesting new Steam client beta dropped overnight from Valve with some exciting low-level enhancements...
🔗 Source: https://www.phoronix.com/news/Steam-Linux-Beta-In-Container
#linux#steam
📰 Unity announce expanded supported for Steam, Native Linux, Steam Deck and Steam Machine
For GDC 2026, Unity revealed expanded official support is coming for Steam. This includes Native Linux, Steam Deck, Steam Machine and more.Read the full article on GamingOnLinux.
🔗 Source: https://www.gamingonlinux.com/2026/03/unity-announce-expanded-supported-for-steam-linux-steam-deck-and-steam-machine/
#steam#linux
📰 I'm Low-key Hyped for This Data Center Sim (Though It Has No Official Linux Support)
There's a free demo up on Steam right now, and I took it for a spin.
🔗 Source: https://itsfoss.com/data-center-game/
#steam#linux
📰 Lutris 0.5.21 Adds Steam Sniper Runtime and New Console Emulators
Lutris 0.5.21 introduces support for Valve’s Sniper runtime, adds ShadPS4 and Xenia runners, and improves GPU detection on Linux systems.
🔗 Source: https://linuxiac.com/lutris-0-5-21-adds-steam-sniper-runtime-and-new-console-emulators/
#linux#steam
📰 After 6 Years, One of Wayland’s Most Annoying Problems is Finally Getting Fixed
The new xdg-session-management protocol finally brings session saving and restoration to Wayland, eliminating a long-standing annoyance for Linux users and paving the way for a smoother desktop experience.
🔗 Source: https://feed.itsfoss.com/link/24361/17308544/wayland-session-management
#wayland#linux
📰Foot: The Wayland Terminal Most Linux Users Don’t Know About
Foot is a minimal Wayland-native terminal emulator for Linux that focuses on speed and simplicity. A hidden gem worth exploring.
🔗 Source: https://feed.itsfoss.com/link/24361/17298790/foot-terminal
#linux#wayland
📰 NVIDIA 595.45 Beta Linux Driver Released With Vulkan Updates and Wayland Changes
NVIDIA has released the 595.45 beta Linux driver, featuring new Vulkan extensions, Wayland updates, DRI3 1.2 support, and several stability improvements.
🔗 Source: https://linuxiac.com/nvidia-595-45-04-beta-linux-driver-released/
#wayland#linux
📰 NVIDIA 595.45 Beta Linux Driver Released With Vulkan Updates and Wayland Changes
NVIDIA has released the 595.45 beta Linux driver, featuring new Vulkan extensions, Wayland updates, DRI3 1.2 support, and several stability improvements.
🔗 Source: https://linuxiac.com/nvidia-595-45-04-beta-linux-driver-released/
#wayland#linux
📰 Linux Mint Previews Native Cinnamon Screensaver With Wayland Support
Linux Mint introduces a native Cinnamon screensaver with Wayland support and adds a sensors page to System Reports.
🔗 Source: https://linuxiac.com/linux-mint-previews-native-cinnamon-screensaver-with-wayland-support/
#linux#wayland
📰 AerynOS 2026.02 Brings More Wayland Compositor Options, Other Improvements
AerynOS 2026.02 was released for closing out February as the newest alpha release for this Linux distribution formerly known as Serpent OS. In AerynOS 2026.02 are many package updates plus continued work on the tooling and other innovations around this Linux distribution...
🔗 Source: https://www.phoronix.com/news/AerynOS-2026.02
#linux#wayland