Context Menu shortcut to WSL program in Microsoft Terminal
This blogpost is mostly stolen from Nick Janetakis.
I use WSL for lots of daily tasks, including editing text files in vim
. Together with Microsoft Terminal (which is actually open source), it makes working on a Windows desktop almost bearable.
However, I still use the Explorer to browse files mostly, and wanted a quick solution to open textfiles in vim
from there. M$ Terminal (wt
) supports tabs, but I normally don't use these at all, because a tmux
session is started when WSL is first launched. But a new tab is perfect for a quick edit window!
Wall of Shame: curl | sh
What?
Many online tutorials explaining how to install software provide installation instructions similar to this:
curl -sSL https://example.com/installer.sh | sudo sh
This is bad advice. You should not run commands like this blindly!
Why?
The above command gets a script file from the internet, and executes it as root
without you knowing what's going on. This also applies to installations in your user context (no sudo
/su
).
Call me weird, but I like to take a look at what a script from the internet is doing before I run it.
Even if you trust the source, there still exists the possibility of a compromised supply chain - someone unauthorized might have added something nasty to installer.sh
.
Filip has a very nice blog post about the attack surface offered.
So please, for your own and your devices safety, review installation scripts.
Who?
Rust
$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
"The Rust Programming Language", also known as "the book", is the very first thing recommended to people wanting to learn Rust by the official website. The installation section provides this snippet.
oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
We're getting advanced - providing both curl
and wget
directly on the homepage!
Gitlab
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
Now what is this, a script.deb.sh
? Step 2 in the install instructions for Ubuntu and Debian.