[solved] symbolic linking does not work

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
Eraemaajaervi
Level 1
Level 1
Posts: 5
Joined: Sat May 30, 2009 10:29 am

[solved] symbolic linking does not work

Post by Eraemaajaervi »

Hi,
I'm actually not a newbie to linux/linux mint, but this kind of feels like a newbie question....

I have problems creating symbolic links

Code: Select all

erae@home ~ $ echo "test" > file
erae@home ~ $ ln -s file link && cat link
test
erae@home ~ $ ln -s file dir/link && cat dir/link
cat: dir/link: No such file or directory
erae@home ~ $ ls -l dir/
total 0
lrwxrwxrwx 1 erae erae 4 2009-10-14 20:32 link -> file
erae@home ~ $ ls -ld dir/
drwxr-xr-x 2 erae erae 4096 2009-10-14 20:32 dir/
so why can't I read my symbolic link?
sometimes instead of "No such file...." it says "Too many levels of symbolic links"
hard linking works fine.

any ideas how to fix this?

Code: Select all

erae@home ~ $ uname -a
Linux home 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686 GNU/Linux
Last edited by Eraemaajaervi on Wed Oct 14, 2009 4:05 pm, edited 1 time in total.
User avatar
Fred
Level 10
Level 10
Posts: 3337
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: symbolic linking does not work

Post by Fred »

Eraemaajaervi,

Use the below process to create a symlink.

cd to the directory you are going to make the symlink in.

Use the command: ln -sf target_file/folder_path symlink_filename

Watch your spacing.

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Kaye
Level 5
Level 5
Posts: 933
Joined: Fri Feb 06, 2009 5:05 pm
Location: Boston College
Contact:

Re: symbolic linking does not work

Post by Kaye »

I was just about to say the same thing.. click post and what do you know, Fred beat me to it :D
"In somnis veritas"
Antivirus or defragging?
Image
Eraemaajaervi
Level 1
Level 1
Posts: 5
Joined: Sat May 30, 2009 10:29 am

Re: symbolic linking does not work

Post by Eraemaajaervi »

thanks, this worked out.

is there a way to create a symbolic link in a directory other than the current?
User avatar
DrHu
Level 17
Level 17
Posts: 7522
Joined: Wed Jun 17, 2009 8:20 pm

Re: [solved] symbolic linking does not work

Post by DrHu »

Fred wrote:Eraemaajaervi,
Use the below process to create a symlink.
cd to the directory you are going to make the symlink in.
Use the command: ln -sf target_file/folder_path symlink_filename
Watch your spacing.
Fred
Fred's advice was just to make it easy (for sure) to work, by first Changing Directory (CD to the target for the softlink (ln -s)

Just include the complete path, you might need to escape any entries, depending on how they are being named, Linux cannot use spaces in names unless escaped \ or quote 'lastname test direct'

In terminal, check
  • man ln
--will give you the command line options for the ln (link) command
--a careful reading should help
http://www.cyberciti.biz/faq/unix-creat ... n-command/
http://linux-programming.suite101.com/a ... nk_with_ln
http://tldp.org/LDP/LG/current/staff.html
Lantesh
Level 6
Level 6
Posts: 1214
Joined: Sat Apr 12, 2008 1:02 pm

Re: [solved] symbolic linking does not work

Post by Lantesh »

If you don't want to use the terminal you can click and drag. Open two seperate Nautilus windows side by side, one with the original file, and the other showing the directory you want to place the sym link in. Now click down and hold the center mouse button on the original file, and drag it over to the other window where you want the sym link. Let go and a menu will pop up showing the option to make the link. Lastly rename the new sym link to whatever you want to call it.
User avatar
mick55
Level 6
Level 6
Posts: 1485
Joined: Fri Sep 25, 2009 2:47 am

Re: [solved] symbolic linking does not work

Post by mick55 »

Right on Lantesh, thats the method i use to create shortcuts to my playlists.
Works like a champ. :lol:
Things are more like they are now than they ever were before.

Dwight D. Eisenhower (1890 - 1969)
Lantesh
Level 6
Level 6
Posts: 1214
Joined: Sat Apr 12, 2008 1:02 pm

Re: [solved] symbolic linking does not work

Post by Lantesh »

Yeah the terminal is obviously a powerful tool, but sometimes you just can't beat a simple click and drag. 8)
User avatar
Kaye
Level 5
Level 5
Posts: 933
Joined: Fri Feb 06, 2009 5:05 pm
Location: Boston College
Contact:

Re: [solved] symbolic linking does not work

Post by Kaye »

The funny thing is, I didn't even think about a GUI solution when I read this post.

I'll take that as a sign that I'm becoming more of a purist :lol:
"In somnis veritas"
Antivirus or defragging?
Image
Eraemaajaervi
Level 1
Level 1
Posts: 5
Joined: Sat May 30, 2009 10:29 am

Re: [solved] symbolic linking does not work

Post by Eraemaajaervi »

@DrHu:
But as you can see in my example I haven't been using any spaces or non-alphabetical characters.

@Lantesh:
The GUI is not s solution for me here (although it seems pretty nice) because I want to use this for a little script
Post Reply

Return to “Newbie Questions”