How can I run Gitk on WSL 2? - wsl-2

How can I run Gitk on WSL 2?
I already installed Gitk in WSL 2.
After I installed Gitk, I tried to run it but it failed with below error log:
application-specific initialization failed: no display name and no $DISPLAY environment variable
Error in startup script: no display name and no $DISPLAY environment variable
while executing
"load /usr/lib/x86_64-linux-gnu/libtk8.6.so Tk"
("package ifneeded Tk 8.6.8" script)
invoked from within
"package require Tk"
(file "/usr/bin/gitk" line 10)
Could you help me how can run Gitk on WSL 2?

You can install and run gitk straight from ubuntu terminal on Windows 11, using apt install.
I've just followed the steps from the following post and it worked:
https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps
I had to update not only the graphic driver but also the WSL.
Now, I can use either gitk or any linux app on Windows 11.

If git is installed on windows, you can find the gitk.exe by typing the following command to windows cmd:
where gitk
you can reach this folder from your wsl by changing the path e.g. from
C:\Git\cmd\gitk.exe
to
/mnt/c/Git/cmd/gitk.exe
and by typing this path to the terminal of your linux distribution, gitk can be opened.
UPDATE:
If you want to open gitk by typing it, you can add the path to ~/.bashrc with the following command (needed only once):
echo 'alias gitk="/mnt/c/Git/cmd/gitk.exe"' >> ~/.bashrc
And after that you can open gitk like:
gitk

Related

node: command not found - in wsl bash [duplicate]

This question already has answers here:
How can I run a Windows executable from WSL (Ubuntu) Bash
(6 answers)
Closed 5 months ago.
I install docker on my windows 10. after that I get a message that I need to download and install wsl2.
Now, when I run bash command I get wsl bash.
When I try to run node I get an error (node.exe is installed in my windows10):
DESKTOP-BVRDS:/tmp/docker-desktop-root/mnt/host/c/Users/myuser# node
bash: node: command not found
when I run echo $PATH I get output of:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
and not the windows path's. (where the node and other software installed).
How to solve this error? maybe change the default bash? to git bash? (which I don't know how)
In Cmder, open settings: Win + Alt + P
Under Startup > Tasks, add a task called {bash} with the following settings:
Task parameters (set icon):
For Cmder icon: /icon "%CMDER_ROOT%\cmder.exe"
For Git icon: /icon "C:\Program Files (x86)\Git\etc\git.ico"
Commands (open Git's bash shell):
"C:\Program Files (x86)\Git\bin\sh.exe" -l -new_console:d:%USERPROFILE%
Under Startup, set startup options to Specified name task --> {bash}
Please check below a couple of articles and should solve an issue.
https://gist.github.com/nickautomatic/02ccb76292f7f8d9767e
https://gingter.org/2016/11/16/running-windows-10-ubuntu-bash-in-cmder/
Please try below:
Open a regular command prompt (win+r then cmd)
Right-click the title bar and select Properties
Deselect "Use legacy console (requires restart)"
Now it should work either by launching the standalone app, or typing bash into a regular cmd window after restarting Command Prompt.

Trying to run cygwin64 inside anaconda, can't get Tee command to run

I need to run a script (already given to me) called run_softmax.sh that runs some commands (including 'python') on my windows 10 machine. I have anaconda and cygwin64 installed. Inside anaconda, I first activate my python environment. Then I tried running C:\cygwin64\bin\bash run_softmax.sh but it gives me run_softmax.sh: line 13: tee: command not found
How can I add this functionality to cygwin?

adding tk-8.6.8 package for cygwin

I install and run PWgui-6.2 in cygwin, and get this message
"couldn't load file "/usr/bin/tk86.dll": No such file or directory
while executing
"load /usr/bin/tk86.dll Tk"
("package ifneeded Tk 8.6.8" script)".
I guess the package tk-8.6.8 is lacked in cygwin so I try to add this package. However I can't find out this package from repository.
Could you help me to solve this problem?
The answer is here: Cannot launch git gui using cygwin on windows, and this is essentially a duplicate question. The problem is that
gitk and git gui require X11 in Cygwin.
Solution
Install some of the Cygwin X11 packages:
Run the Cygwin installer again.
Install "xinit" under the X11 category, accepting all the dependencies.
(Windows Start menu should now include: Cygwin-X)
Start menu > run XWin Server
In Cygwin shell, run
export DISPLAY=:0.0
At this point I got "Authorization required, but no authorization protocol specified", so to fix that set
enable_xauth=0 in \bin\startxwin
(Note:)
Will need to run XWin Server every time you reboot, and set export DISPLAY=:0.0 every time you open a new Cygwin shell. (Run echo "export DISPLAY=:0.0" >>~/.profile to have it run automatically whenever a new shell is started).
If you get couldn't connect to display ":0.0", mouse over the X that should be in Windows taskbar tray, the pop-up should say something like Cygwin/X Server:1.0. Use that ":1.0" (or similar) instead as the value for export DISPLAY.
Install windows Git.
Uninstall git from cygwin repo.
Set the environment Path for Git "C:\Program Files\Git\cmd" and move it above C:\cygwin64\bin

no linux command found after installing jdk1.8 on redhat distribution?

After i installed correctly jdk1.8.0 on my redhat distribution and restarted my computer, no linux command is found anymore! the last step i did in the installation of jdk1.8.0 was to write these variables in /etc/environment as it's mentionned in a link which by the way i followed to install jdk1.8.0 :
export JAVA_HOME=/opt/jdk1.8.0_121
export JRE_HOME=/opt/jdk1.8.0_121/jre
export PATH=$PATH:/opt/jdk1.8.0_121/bin:/opt/jdk1.8.0_121/jre/bin
when the day after i started my machine, i do "dir" or "ls" or "vi" or whatever else;
bash dir: command not found
bash vi: command not found
I read in the net that i've messed a path, but no solution is suggested. so how could i fix this problem ? Thank you for your help.

Is it possible to run gitk in cloud9

I get the following when trying to run gitk in cloud9-ide
application-specific initialization failed: no display name and no $DISPLAY environment variable
Error in startup script: no display name and no $DISPLAY environment variable
while executing
"load /usr/lib/x86_64-linux-gnu/libtk8.6.so Tk"
("package ifneeded Tk 8.6.1" script)
invoked from within
"package require Tk"
(file "/usr/bin/gitk" line 10)
gitk is a visual git tool and Cloud9 doesn't have a gui, only a terminal. So unfortunately they're not going to work together. You could try using tig, which is visual but works with the Cloud9 terminal.
If you have an ssh connection open in the background (like PUTTY) and you have XForwarding configured correctly on that connection. You can launch gitk from the cloud9 terminal.

Resources