PDA

View Full Version : [SOLVED] What mean symbolic link ?



User808
23rd October 2017, 07:00 PM
Hi. In my Cinnamon DE, when I right click a file, then a list appearing contains an option: create symbolic link.
What does this link mean & for what could be used ?
Best.

lsatenstein
23rd October 2017, 11:34 PM
A symbolic link is created with ln -s

It is a shortcut to another directory of file.

For example, my home directory is a symbolic link to a directory on another disk. Here is an example

ll or ln -s

lrwxrwxrwx. 1 leslie leslie 12 Oct 1 00:56 bin -> /scratch/bin
lrwxrwxrwx. 1 leslie leslie 20 Oct 1 00:56 Development -> /scratch/Development
lrwxrwxrwx. 1 leslie leslie 18 Oct 1 00:56 Documents -> /scratch/Documents
lrwxrwxrwx. 1 leslie leslie 18 Oct 1 00:56 Downloads -> /scratch/Downloads
lrwxrwxrwx. 1 leslie leslie 14 Oct 1 00:56 Music -> /scratch/Music
lrwxrwxrwx. 1 leslie leslie 17 Oct 1 00:56 Pictures -> /scratch/Pictures
lrwxrwxrwx. 1 leslie leslie 15 Oct 1 00:56 Public -> /scratch/Public
lrwxrwxrwx. 1 leslie leslie 8 Oct 1 00:56 scratch -> /scratch
lrwxrwxrwx. 1 leslie leslie 18 Oct 1 00:56 Templates -> /scratch/Templates
lrwxrxrwx. 1 leslie leslie 15 Oct 1 00:56 Videos -> /scratch/Videos

This is my script. I only wanted it to execute for my user id.



#!/bin/bash
if [ $EUID != 1000 ]; then
echo "only valid for usr 1000. You are not authorized to use this script"
echo "only valid for usr 1000. You are not authorized to use this script"
echo "only valid for usr 1000. You are not authorized to use this script"
exit
fi


DIRS="bin Documents Development Documents Downloads Music Pictures Public Videos Templates "
cd ~
for var in $DIRS
do
rmdir ~/$var
mkdir -p /scratch/$var
ln -s /scratch/$var $var
echo ""
done

ln -s /scratch scratch
echo "ln -s /scratch scratch"
ls -l ~



if I do cd ./bin, I will actually be directed to /scratch/bin

What is the advantage? I have 5 disks with xfce, gnome, mate, etc. and they all have the same symbolic links (shortcuts). I did it that way so that one $HOME folder is common to xfce gnome mate, ...

User808
24th October 2017, 04:45 AM
Hi.

I asked this question because I downloaded Shotcut video editor (portable zip) program (not from repositories):

www.shotcut.org

I unzip archive, & cut/past resulted folder "Shotcut" to:

/home/myusername/.local/share/myportables

Please open now attached screesshot. It show you a folder "Shotcut.app" & a red shortcut which is a .desktop file

When I navigate manually to this icon & double click it then program launched & worked 100% without any error & with full functionality !

I tried to create entry to this program in applications menu: right click app menu, configure, menu, open menu editor, then I created entry: I used "browse" to select red icon of Shotcut.

But when I tried this entry it does not work ! I have to navigate manually to red icon to double click it each time ?

Does using symbolic link assist to fix this, & how ?

User808
24th October 2017, 09:52 PM
Issue solved ! No need for symbolic link ! When create entry to program in app menu, do not select red icon of program but navigate inside Shotcut.app folder & select "shotcut" script & it will work !