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
#typescript#docker#docker_compose#linux#rdp#virtualization#windows
WinBoat lets you run any Windows app on Linux with a smooth, native-like experience by running a full Windows system inside a Docker container using virtualization. It has an elegant interface and automates installation, so you just pick your settings and it handles the rest. You can run individual Windows apps seamlessly alongside Linux apps or access the full Windows desktop when needed. Your Linux files are easily shared with Windows, making file management simple. This helps you use Windows-only software on Linux without complicated setups, though it requires some system resources and setup steps like enabling virtualization and installing Docker. WinBoat is still in beta, so occasional bugs may occur.
https://github.com/TibixDev/winboat
📰 Debian Is Figuring Out How Age Verification Laws Will Impact It
With age verification/attestation laws down to the OS level enacted by California and being decided upon by other US states, it's been a hot topic of discussion in the open-source world. For the Debian project that is strictly volunteer/community-driven unlike various commercial Linux platforms, they are figuring out how such laws will impact them...
🔗 Source: https://www.phoronix.com/news/Debian-Undecided-Age-Laws
#linux#opensource#debian
📰 Parrot OS 7.2 Ships with Linux Kernel 6.19 and Copy Fail Fix
Parrot OS 7.2 is now available with Linux kernel 6.19, updated security tools, Debian package sync, and Copy Fail mitigation.
🔗 Source: https://linuxiac.com/parrot-os-7-2-ships-with-linux-kernel-6-19-and-copy-fail-fix/
#debian#kernel#linux
📰 GParted Live 1.8.1-3 Released with Linux Kernel 6.19.10 and GParted 1.8.1
GParted Live 1.8.1-3 Debian-based live system for performing disk partitioning tasks using the GParted partition editor is now available for download with Linux kernel 6.19.
🔗 Source: https://9to5linux.com/gparted-live-1-8-1-3-released-with-linux-kernel-6-19-10-and-gparted-1-8-1
#linux#kernel#debian
📰 GParted Live 1.8.1 Released With Linux Kernel 6.19
GParted Live 1.8.1, a bootable Linux system for disk partitioning, is out with Linux kernel 6.19, Debian Sid updates, and the stable GParted 1.8.1 release.
🔗 Source: https://linuxiac.com/gparted-live-1-8-1-released-with-linux-kernel-6-19/
#kernel#linux#debian
📰 SparkyLinux 2026.03 Tiamat Released Based on Debian Testing Forky
SparkyLinux 2026.03 has been released, featuring updated Debian Testing packages, Linux kernel 6.19, and refreshed rolling ISO images.
🔗 Source: https://linuxiac.com/sparkylinux-2026-03-tiamat-released-based-on-debian-testing-forky/
#kernel#debian#linux
📰 SparkyLinux 8.2 Released with Support for Linux Kernel 6.19, Updated Packages
SparkyLinux 8.2 distribution is now available for download with support for Linux kernel 6.19, based on Debian 13 "Trixie". Here's what's new!
🔗 Source: https://9to5linux.com/sparkylinux-8-2-released-with-support-for-linux-kernel-6-19-updated-packages
#linux#debian#kernel
📰 Google Now Using AutoFDO To Enhance Android's Linux Kernel Performance
Google's Android LLVM toolchain team shared publicly this week that they have begun making use of AutoFDO for automatic feedback directed optimizations of their Linux kernel build used by Android...
🔗 Source: https://www.phoronix.com/news/Android-Using-Linux-AutoFDO
#kernel#android#linux