А знаете ли вы, что в Bash есть особая переменная "$_" ? Из описания можно узнать, что в переменную "$_" помещается последний аргумент последней команды.
Что-то знакомое? Конечно, в Python есть примерно тоже самое.
Мы знаем, что дата первого релиза Bash (8 июня 1989) несколько раньше чем первый релиз Python (20 февраля 1991). Если учесть, что по задумке автора Python это агрегация самых успешных практик отовсюду, можно ли сказать что именно эта фишка к нему пришла из Bash? Ни подтверждения ни опровержения я пока не нашел.
Давайте просто считать это совпадением 😉
А как это может быть полезно в Bash?
Приведу простой пример, который оценят те, кто часто работает в терминале.
Допустим, нам надо создать директорию и зайти в неё. Что обычно делаем?
:~$ mkdir foldername
:~$ cd foldername
:~/foldername$
Как это сделать в одну команду?
:~$ mkdir foldername && cd foldername
:~/foldername$
Уже лучше, но хочется короче, без повторов. Вот тут и пригодится наша переменная. Напомню, что в неё сохраняется последний аргумент предыдущей команды.
:~$ mkdir foldername && cd $_
:~/foldername$
_________________
PS.
Символы "&&"" разделяют команды и означают, что требуется выполнить вторую команду только если первая завершилась успешно.
#linux#tricks
▎SmartDNS
SmartDNS 是一个运行在本地的 DNS 服务器,它接受来自本地客户端的 DNS 查询请求,然后从多个上游 DNS 服务器获取 DNS 查询结果,并将访问速度最快的结果返回给客户端,以此提高网络访问速度。
SmartDNS 同时支持指定特定域名 IP 地址,并高性匹配,可达到过滤广告的效果; 支持DOT(DNS over TLS)和DOH(DNS over HTTPS),更好的保护隐私。
与 DNSmasq 的 all-servers 不同,SmartDNS 返回的是访问速度最快的解析结果。
支持树莓派、OpenWrt、华硕路由器原生固件和 Windows 系统等。
项目地址:https://github.com/pymumu/smartdns
SmartDNS官网:https://pymumu.github.io/smartdns
标签:#OpenWrt#Windows#路由#Linux
📰 Linux's adorable Tux the Penguin mascot turns 30 today, and the OG design is still being used
Whenever people think of Linux, the first thing that springs to mind, regardless of whether they're an open-source vet or if they've never even touched a Linux PC before, is Tux. Tux is the penguin associated with the Linux kernel as a whole, and he's found his way onto operating systems, merch, and various memes that depict the image creator's distaste for Windows.
🔗 Source: https://www.xda-developers.com/linuxs-tux-the-penguin-mascot-turns-30-today/
#kernel#linux#opensource
📰 Nouveau vs. NVIDIA R595 Linux Driver For Workstation Graphics Performance
When having the HP Z6 G5 A workstation in the lab for benchmarking, one of the curiosity-driven tests was seeing how well the latest open-source and upstream Nouveau driver stack is competing against the latest official NVIDIA R595 driver for workstations. The official NVIDIA Linux driver stack remains the best positioned software solution for RTX (PRO) hardware but Nouveau continues evolving while awaiting the Nova kernel driver to reach the...
🔗 Source: https://www.phoronix.com/review/nvidia-nouveau-nvk-may2026
#kernel#linux#opensource
📰 RISC-V BeagleV Ahead Single Board Computer To See Working HDMI With Linux 7.1
The BeagleV Ahead is an open-source RISC-V single board computer S(BC) built around the quad-core TH1520 SoC. With the Linux 7.1 mainline kernel there is HDMI display support coming now that the Device Tree bits have been added...
🔗 Source: https://www.phoronix.com/news/Linux-7.1-BeagleV-Ahead-HDMI
#kernel#linux#opensource
📰 NXP Neutron NPU Kernel Driver Blocked For Now By A Closed-Source User-Space Blob
Last month NXP posted open-source Linux kernel driver patches for their Neutron NPU accelerator. The NXP Neutron NPU aims to help with edge AI applications and this neural processing unit is found in their different SoCs. Unfortunately, their GitHub repository for the user-space software ends up containing a binary-only blob that will end up delaying plans on getting this driver into the mainline Linux kernel...
🔗 Source: https://www.phoronix.com/news/NXP-Neutron-NPU-User-Blob
#opensource#linux#kernel
📰 OpenWrt 25.12 Released with APK Package Manager Replacing opkg
OpenWrt 25.12 open-source router firmware arrives with a major shift to the APK package manager, replacing opkg, alongside Linux kernel 6.12.
🔗 Source: https://linuxiac.com/openwrt-25-12-released-with-apk-package-manager-replacing-opkg/
#kernel#linux#opensource