Windows sublinux - get windows path where linux was called - linux

is it possible to get the directory path from Windows where for example "debian" was executed?
For example I open my projects with Visual Code and execute the NodsJs/npm projects from Windows WSL Debian. So it would be nice if "debian" is called from inside the Visual Code console that my linux subsystem auomatically joins the Windows directory from where I am coming.
Yes I am already using symlinks but then I have to create a symlink for each project. An automatically solution would be much more comfortable.
I googled and haven't found something regarding this. Would be great if someone can tell me if this is possible or not.

I was not sure what you meant but apparently there's a debian.exe that lands in the users home dir.
You can just use the wsl.exe to get the behavior that you described.
i.e. wsl.exe -d "Debian"
Which looks like this on the shell
PS C:\Users\PeterT> cd C:\DEV
PS C:\DEV> wsl.exe -d "Debian"
petert#debian:/mnt/c/DEV$

Related

sdkman appears to be installed but not showing up on my drive

I have started learning groovy and I just came across the SDKMAN utility.
To give it a try I folllowed the installation guidelines at the official site of sdkman and tried to run the below command to install sdkman on Windows 10 :
set SDKMAN_DIR="E:/sdkman" && curl -s "https://get.sdkman.io" | bash
But I donot see any sdkman folder present in my E drive.
When I try to re-run the command it says :
Looking for a previous installation of SDKMAN...
SDKMAN found.
======================================================================================================
You already have SDKMAN installed.
SDKMAN was found at:
"E:/sdkman"
I am just confused as to why am I not able to see it with my eyes. I have even tried enabling view hidden items.
Tried to execute which sdk. but it clearly says which: no sdk in (..
...
has anyone else experienced similar issue. Any help is highly appreciated.
which bash implementation are you using under windows? cygwin? gitbash?
I believe at least in gitbash that the path syntax is /e/sdkman/, i.e. you would do:
export SDKMAN_DIR="/e/sdkman" && curl -s "https://get.sdkman.io" | bash
but it's been a long time since I was on windows and I suspect this is bash-implementation specific (i.e. it might differ between cygwin and gitbash for example).
If this assumption is correct, the syntax you were using might have created a directory called E:/sdkman under your user's home directory or whatever directory you happened to be in when you ran this. Just guessing here, but worth a look.

how to run non-installed(portable) application using linux terminal

I'm new to Linux and i use Kali Linux. I downloaded the eclipse ide. Every time, when i need to run it, i should navigate to eclipse folder and run the eclipse file. there are other softwares like pycharm have the same issue.
If there's any method to run these programs just typing "eclipse" or "pycharm" on terminal (like firefox, atom) it's very helpful. If anyone know how to do it please let me know. I already searched a solution for this problem and i couldn't find any solution.
-Thanks (sorry for my English)
Modify your ~/.bashrc and add the PATH of your application(you use PATH rather then CONFIG_PATH)
export PATH=$PATH:/path/to_directory_containing_program
export CONFIG_PATH=/my_path_to_PROGRAM/PROGRAM/config/
Another solution is Create a shorcut in your desktop
Go to cd /usr/local/bin (or cd /usr/bin) and do:
sudo ln -s /path/to/eclipse where eclipse is the binary that you are used to launch.
/usr/local/bin and /usr/bin directories should already be in your PATH, so you don't need to modify ~/.bashrc.

How can i make an application installed from sourse to be able to work as "enviroment variable" in linux command line

For personal preference reasons , and updating simplicity, i prefer the installation location /opt (when i install from source).
But for example if i install node or ffmpeg to /opt (./configure --prefix=/opt) the commands are not available in command line, but if i wouldn't use the prefix it would.
I should be creating i guess a script but i have no idea to which location and how.
Some more detail: I have installed nginx server in /opt/ , and i have created an executable script in /etc/init.d/ and its working fine, but i have no idea how to do that with node or ffmpeg since as far as i know they are not service but something more like "environment variables".
Any solution appreciated, thanks.

Find out how or where a program (script) is automatically starting at ubuntu 14 boot?

Running Ubuntu 14.04, and I have a script that is being run automatically when I boot the machine. For the life of me, I can't remember how or where I did this.
I already checked:
upstart (which doesn't seem to be available here, anyway)
/etc/rc.local
crontab (with #reboot)
/etc/init
/etc/init.d
.config/autostart (doesn't exist btw)
It's a script of my own, so it's not some kind of malicious virus or malware or anything. I just can't remember how I did this, and would like to know.
It has a distinct name, e.g. like ~/MyScriptXYZ.sh so I could search for that, IF I know how or where..?? (I'm a novice linux user)
A few other places you can look:
crontab -e as your own user and as root (local user crontab)
/etc/profile.d/ or /etc/profile
~/.profile
~/.bashrc
The last ditch attempt you can do is to cd / && grep -R "MyScriptXYZ" as root - this will take a while but will search all files on your computer for that reference :)
So I stumbled across this question and I managed to solve it for myself:
I was using Ubuntu (chroot) through the Linux Deploy Android app and I also couldn't find it. So to make the answer complete: Use pstree to locate and trace what is currently running and see where it's originating from.
Following Basile Starynkevitch's advice I managed to solve it by going to:
/home/[user]/.config/lxsession/LXDE/autostart and find it the code I added a while ago.

make: pwd: Command not found

I am new to using make files. I have cygwin and MinGW. I'm still looking into their differences.
Anyway, I have a makefile that is used to create a project for an FPGA, which I have never done before. I have included C:\cygwin\bin and C:\MinGW\msys\1.0\bin in my PATH, but I always get this error.
make: pwd: Command not found
I typed pwd into the cmd prompt and get a correct response. Any pointers? Am I missing something? Not sure what else I can try. Most forums I have found pertaining to this error never have a resolution.
Let me know what information you'd like.
pwd is commonly both a shell built-in command and a standalone executable, provided by GNU coreutils (which Cygwin installs by default).
If you're invoking make from the Cygwin environment (say, typing make at a bash shell prompt), then C:\cygwin\bin is the wrong way to specify the directory. That's the path as seen from Windows. From within Cygwin, it's /bin -- and it should be in your default $PATH. The Cygwin equivalent of C:\MinGW\msys\1.0\bin would be /cygdrive/c/mingw/msys/1.0/bin
If you're doing this directly from Windows rather than in the Cygwin subsystem, then C:\cygwin\bin is the path to the Cygwin bin directory -- but running C:\cygwin\bin\pwd is going to give you a Cygwin-specific directory name that's not going to be meaningful to Windows.
I have encountered the same issue in my mingw environment. It turned out in my case to be a missing 'pwd'executable in the msys/bin directory. Once the copying was done properly, everything fell into place. Hope this helps

Resources