LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-07-2011, 05:04 AM   #1
Uaebuntu
Member
 
Registered: Feb 2011
Location: Dubai
Distribution: Unbuntu 16.04
Posts: 44

Rep: Reputation: 0
symlink or hardlink? and how to do it at start up


2.6.38-8-generic
Mint 11 64 bit

I'm trying to move a file from a directory to another one and create a symlink but seem to be doing something wrong. Have done "man ln" and looked up info in coreutils but I don't seem to be able to get it right.

There are two files in ./home/jim/.config/banshee-1/ that I want to move to ./home/jim/Dropbox/banshee. I have created backups of both and created the new folder in Dropbox. see attached screen shots. I then run

Code:
jim@saturn ~ $ sudo ln -s ./home/jim/Dropbox/banshee/banshee.db ./home/jim/.config/banshee-1/banshee.db
ln: creating symbolic link `./home/jim/.config/banshee-1/banshee.db': No such file or directory
and get the above error message. Now I know symlinks do not need to be complete at the time of creation, but I'm not sure if I have done this right or not and if I try and read and write banshee.db at the original location if it will do it properly and efficiently. Is this a case where I should do a hardlink instead and have both files.

If I want to do this every time at start up, how do I automate the commands once I have them right?
Attached Thumbnails
Click image for larger version

Name:	Screenshot-banshee-1.png
Views:	4
Size:	61.7 KB
ID:	7240   Click image for larger version

Name:	Screenshot-banshee.png
Views:	3
Size:	53.7 KB
ID:	7241  
 
Old 06-07-2011, 05:09 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
What's with the leading "."? You're writing these as *relative* paths, not absolute, so this command will only work if you are running it from / itself, which would be odd. Just remove the . at the start of the paths.

But you said you want to *move* the file... so why are you trying to make a link?? why not just move / copy it??
 
Old 06-07-2011, 05:17 AM   #3
ssrameez
Member
 
Registered: Oct 2006
Location: bangalore
Distribution: Fedora, Ubuntu, Debian, Redhat
Posts: 82

Rep: Reputation: 6
the Error clearly mentions that the file "./home/jim/.config/banshee-1/banshee.db" is not present.
As the previous answer mentions, it is not a good idea to create softlinks with relative path, but not uncommon.

cd <to the path where you want to create the softlink>
ln -s <absolute path to which you need to point the softlink> <softlink>

This will work.
 
1 members found this post helpful.
Old 06-07-2011, 06:03 AM   #4
Uaebuntu
Member
 
Registered: Feb 2011
Location: Dubai
Distribution: Unbuntu 16.04
Posts: 44

Original Poster
Rep: Reputation: 0
almost there.. symlink now working.

To answer the questions, I thought this command had to be done from / hence the use of sudo and ./ however this worked, so thanks for the help.

Code:
jim@saturn ~/.config/banshee-1 $ ln -s /home/jim/Dropbox/banshee/banshee.db banshee.db
jim@saturn ~/.config/banshee-1 $ ln -s /home/jim/Dropbox/banshee/ossifer-browser-cookies.sqlite ossifer-browser-cookies.sqlite
jim@saturn ~/.config/banshee-1 $
I had copied the files to the new location and renamed the originals so I can make use of Dropbox synchronisation.

Banshee is working OK with the files in the new location, which means I can sync metadata across computers (which there is another post for)

Now I have run these command is the link permanent or do I have to do it every time I reboot? If I have to do it every reboot is there some where I can put the commands so the are executed on start up?
 
Old 06-07-2011, 06:18 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
a symlink is a real entry in the filesystem, just like a file is, so it's totally persistent.
 
1 members found this post helpful.
Old 06-07-2011, 08:27 AM   #6
Uaebuntu
Member
 
Registered: Feb 2011
Location: Dubai
Distribution: Unbuntu 16.04
Posts: 44

Original Poster
Rep: Reputation: 0
Thanks all works perfectly now.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Question How to get stat() of symlink and not of target of symlink ? ronbarak Programming 3 11-08-2010 01:14 PM
[SOLVED] can not start jar app using symlink in different directory due to file not found! nocountryman Linux - Software 4 03-17-2010 05:11 AM
Is hardlink support on Jffs FS? alice95089 Linux - Software 0 02-17-2005 11:11 PM
Hardlink shivanandbg Linux - General 1 04-27-2004 11:14 AM
symlink to start dhcpcd alany Linux - General 10 12-09-2002 08:09 PM


All times are GMT -5. The time now is 12:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration