Linux SoftLink to applications and execution - linux

I have created a softlink to an application using the following command:
ln -s sourcedir/Application somedir/ApplicationSoftLink
But I do not know how to start the application using the softlink. My understanding of a softlink is that it is the same as a shortcut in Windows, you just double-click the shortcut and the application will launch. However, when I tried to ./ApplicationSoftLink the application would not start.
Could someone please provide some assistance?

ln -s sourcedir/Application somedir/ApplicationSoftLink probably puts the wrong path in your symbolic link.
Try:
ln -s $PWD/sourcedir/Application somedir/ApplicationSoftLink

Were you in somedir when you tried running ./ApplicationSoftLink?
I think what you want to do is create the link in some directory in your path, so you don't have to say where the file is at all. You can type
echo $PATH
to find out what's in your path. /usr/local/bin is a good choice for things like this.

is sourcedir/Application executable?
when I tried to "./ApplicationSoftLink" the application would not
start.
Is there any error message?
were you typing ./ApplicationSoftLink under "somedir"?
or try ln -s /absolute/path/sourcedir /absolute/path/you/want/somedir/myApp
then under somedir/myApp/ run ./Application

Related

Symbolic Link to folder not working as expected

so i want to start tomcat server, to do this i have to run a script whose path is the following:
/usr/local/Cellar/tomcat/9.0.6/libexec/bin/strartup.sh
Since it is tedious to remember this, i made a simbolic link:
tomcatsh/startup.sh
so with the ln command tomcatsh points to /usr/local/Cellar/tomcat/9.0.6/libexec/bin
There is a problem when i run the shortened version, it yelds an error saying that the startup.sh script couldn't find setclasspath.sh .
this other script is in the same folder, and it is not missing, why doesn't startup find that script? What can i do to solve this problem?
If previously that symlink is defined for the folder of the file, you have to call command with update parameter
ln -sf <file> <symlink>
rather than creation parameter
ln -s <file> <symlink>

softlink to binary always use home folder path (instead of current folder)

kdevelop provides this AppImage binary:
wget -O KDevelop.AppImage https://download.kde.org/stable/kdevelop/5.1.1/bin/linux/KDevelop-5.1.1-x86_64.AppImage
chmod +x KDevelop.AppImage
./KDevelop.AppImage
It works well. So I want to make a soft link called kd to that binary in /usr/bin, eg:
/usr/bin/sudo ln -s KDevelop-5.1.1-x86_64.AppImage kd
Now if I run kd file1, I'd expect that it would open a file name file1 in the current folder, but it always tries to open a file name file1 in my home folder - which is not where it should be.
Is there some way to fix this issue?
Some possible causes:
The application always assumes that you want to open files in your home directory, effectively or literally prepending $HOME to the path. This would be a bug in any *nix program, and should be reported.
The application behaves differently when $(basename "$0") is not KDevelop.AppImage (what #Scheff said).
You are actually running a different kd.
Possible workarounds/investigations:
Pass the full path to the file on the command line. If it tries to open /home/you//full/path/you/provided it is obviously buggy, and you have a test case. If it does not, then there might be some gotcha to what your $PWD actually is. Try checking its value before running.
Symlink with the same name, using sudo ln -s KDevelop-5.1.1-x86_64.AppImage /usr/bin, and try running that. If it behaves the same, you've at least proven that the symlink is not the problem.
Run type -a kd and verify that your /usr/bin/kd comes up first. If not there might be an alias or shell built-in which takes precedence.
That said, what is the actual error message?

Linux command to "link" files

When I do "ls -lrt", there is a file that is listed and I want to create link for example,
myfile.config -> /users/yue/home/logs/myfile.config
When making changes in myfile.config it also affects the file in
/users/yue/home/logs/myfile.config.
What command in linux allows for that?
Also, what is this called?
the command is called ln (link )
the basic form is ln pathtosource pathtotarget
here is a nice URL that talks about it http://www.computerhope.com/unix/uln.htm
Figured it out,
Its actually "ln -s " command

Create symbolic link of a folder

Into the folder /usr/local/var I would like to create a symbolic link run that point to /var/run folder. But I'm quite bit confused how to correctly create the link. Should I create initially the run folder?
You can create it like this without the need of creating something before:
ln -s /usr/local/var /var/run
If you are windows users and want to create a symbolic link of a folder is here how:
NOTE: Just make sure you run the command prompt as administrator.
WINDOWS
mklink /d "D:\site\abc\js" "F:\xyz\js"
MAC
ln -s /usr/local/var /var/run

Wrong executable path for python in linux

In linux bash, I need to run an application (HTSeq) which uses python. When I run the command I get this error:
-bash: /app/HTSeq-0.5.3p7/bin/htseq-count: /usr/bin/python26: bad interpreter: No such file or directory
The thing is that I do not have "python26" in my executable path. So in my /usr/bin/ path I have followings:
/usr/bin/python2.6
/usr/bin/python
I think sometimes I have manually changed something incorrectly. But how can I fix it?
Thanks in advance.
Try renaming "python2.6" to "python26" with sudo mv /usr/bin/python2.6 /usr/bin/python26
Well, since you don't have sudo rights, you could try this:
First create a symlink,
ln -s /usr/bin/python2.6 ~/Desktop/python26
and then adding the symlink dir to your PATH variable
export PATH=$PATH:/home/<your account>/Desktop

Resources