This is useful in Rust for the documentation:
cargo doc --open.
or for simply open a file in a browser from bash:
Install it from crates.io and add 2 symbolic links and one env variable:
cargo install wsl_open_browser sudo ln -sf "/mnt/c/Program Files/Mozilla Firefox/firefox.exe" /usr/bin/browser_in_win export BROWSER='/usr/bin/wsl_open_browser' # I like to use the short command `www` to open a browser ln -sf "/usr/bin/wsl_open_browser" www # go to a directory that contains a subdirectory with index.html cd ~/rustprojects/wsl_open_browser www docs/index.html # or www docs # or go inside the directory that contains index.html cd docs www . # or simply www # if you want to open an URL www rust-lang.org
Congratulations! You have just opened a windows browser from WSL2.
This crate does not read or write any files. And does not use any network communication. It is safe. It is just 45 lines of rust code.