home |
electronics |
toolbox |
science club |
tuxtalk |
photos |
e-cards |
online-shop
May 2022
WSL with tabs
When I have to work with a windows PC 10 then I will always look for WSL. WSL is Microsoft's "windows subsystem for linux" aka Ubuntu shell.
It makes Windows finally usable. The only problem is that the Microsoft terminal windows don't have any tabs.
Your desktop becomes really messy if you have a few of those terminal windows with Ubuntu open.
The solution is: Hyper (https://hyper.is/). It allows you to run multiple
ubuntu bash shells in one application window and switch from shell to shell by clicking on the respective tab.
Hyper installation
- Download hyper at https://hyper.is/ and install it.
- After the installation you change the shell that is running inside hyper from powershell to bash: Click on the hamburger icon in the upper left corner to edit the configuration (Edit->Preferences).
- Search for "shell:" and change it to: shell: 'C:\\Windows\\System32\\bash.exe'
Note the double backslash (\\) in the path.
Enjoy WSL with tabs.
Edit the configuration and change the shell to bash.exe
This is what Hyper looks like, WSL with Tabs
Some WSL tips
- There are two versions of WSL: WSL-2 uses NAT between Linux and windows and WSL-1 shares the same network stack with windows.
Most of the time you want the the WSL-1 because you can access the network in the same way as any other application.
This is especially important if you use some VPN software. NAT could cause problems when you have a VPN client running
in windows.
Check which version of WSL you have: Open a powershell with admin rights and run: wsl --list --verbose
Force the version to version 1: wsl --set-default-verion 1
This affects only future installations. To go from WSL 2 to WSL 1 you will have to uninstall WSL (right click on the ubuntu
icon, uninstall).
To re-install WSL from powershell: wsl --install -d ubuntu
The installation takes a while (about 30min). It will ask you for a user and password. This password is the sudo password which you need to become root (it has nothing to do with your windows password).
- Many people who are new to WSL don't know how to access the windows filesystem.
Just type: cd /mnt/c
Now you are on your C: drive in windows.
- WSL requires admin rights during the installation. If you don't have that one your windows machine then you can try https://www.msys2.org/. Msys can be installed in a different location under C:\Users\... and then you will not need admin rights. Msys is not a full linux system but some useful linux commands ported and compiled for Windows.
Windows Terminal as an alternative to Hyper
Microsoft is offering as of Windows 10 "Windows Terminal" which is very configurable
and has also tabs.
It's part of the standard install in Windows 11 but you can manually install it in Windows 10. See https://aka.ms/terminal.
Windows Terminal does not have any context menu or button to access copy/paste functionality. You use the key combination crtl-shift-c and crtl-shift-v. A default Windows Terminal binds however also the key combinations crtl-c and crtl-v. This makes it somewhat unusable as a terminal because crtl-c is used in unix to interrupt a process (send signal SIGINT) and crtl-v is used in vim to mark a rectangular region. It's even a problem if you run powershell inside Windows Terminal because crtl-c is used there too. There is a way to fix this by changing the key binding in settings.
Windows terminal from microsoft is a usable alternative to Hyper.
Here is how to fix the keybinding in Windows Terminal such that crtl-c and crtl-v can be used by the shell running in the terminal. The key combination crtl-shift-c and crtl-shift-v will still work for copy/paste:
Windows terminal default keybinding use crtl-c and crtl-v .
This is how to unbind crtl-c and crtl-v from Windows terminal:
Windows terminal unbound crtl-c and crtl-v.
under actions add:
{ "command": null, "keys": "ctrl+c" },
{ "command": null, "keys": "ctrl+v" },
newer versions of Windows Terminal have a configuration gui (no more need to edit the raw config file but you can still edit it with a text editor if you want)
You access the settings in the older versions and the newer versions of Windows Terminal under settings (in the old version it starts a text editor and you edit the config file).
Access the settings of Windows Terminal
Another strange default setting of windows terminal is the cursor. It's so slim that you
can not see it if you find something in a file (e.g. in less or vi). You can change
it to a normal block:
Windows Terminal change cursor
Under profiles -> defaults you add this to get a proper cursor:
"cursorShape": "filledBox"
Here is sample settings.json file. Take a look if you want to see those setting in the right context. The file is usually found at
c:\Users\XXXXX\AppData\Local\Packages\Microsoft.WindowsTerminal_XXXX\LocalState\settings.json
Make a backup before you change or overwrite the file on your PC. You can use the file also with more recent versions which have this config editor GUI.
© 2004-2024 Guido Socher