LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   creating a link to a deeply nested folder like ~ = /home/username/ (https://www.linuxquestions.org/questions/linux-newbie-8/creating-a-link-to-a-deeply-nested-folder-like-%7E-%3D-home-username-756024/)

AlphaLexman 09-17-2009 04:36 PM

creating a link to a deeply nested folder like ~ = /home/username/
 
I have an external hard drive mounted at /media/exthdd/
On that hard drive I have folders: Music, Pictures, Videos, etc.

Can I make symbolic links to /media/exthdd/Music/ to say the root directory /_ ?

the directory /_ is empty I just want a quick method of typing to get me there much like [cd ~] gets me to my home/username folder.

I have my music organized by Artist/Year-Album/Track.Title.mp3

I want to be able to "cd /_" then "ls" and see all Artist folders.

This is probably very simple I am just not finding it.

slakmagik 09-17-2009 05:03 PM

I'm not sure what you mean by '/_'? You have or want a directory literally named 'underscore'? What I would do is 'ln -s /media/exthdd/Music/ ~/extmusic' or some such. Then 'ls ~/extmusic' should show you the 'Artist' directory.

AlphaLexman 09-17-2009 05:07 PM

I may be looking at the situation backwards but I did a mkdir /_ (just an underscore folder at the root directory)

Are you saying it would be better to link the /media/exthdd/Music/ to something else? I'm a little confused and turned around.

lutusp 09-17-2009 05:09 PM

Quote:

Originally Posted by AlphaLexman (Post 3687657)
I have an external hard drive mounted at /media/exthdd/
On that hard drive I have folders: Music, Pictures, Videos, etc.

Can I make symbolic links to /media/exthdd/Music/ to say the root directory /_ ?

the directory /_ is empty I just want a quick method of typing to get me there much like [cd ~] gets me to my home/username folder.

I have my music organized by Artist/Year-Album/Track.Title.mp3

I want to be able to "cd /_" then "ls" and see all Artist folders.

This is probably very simple I am just not finding it.

It would be much simpler for you to create a desktop shortcut that launches your file browser initialized to the desired directory -- or create a shortcut within your file browser that allows you to go there with a click.

The easiest to explain would be a desktop shortcut -- it's just a plain-text file with certain content:

Code:

[Desktop Entry]
Encoding=UTF-8
Name=Music Browser
Exec=nautilus --browser /path/to/desired/directory
Terminal=false
Type=Application
Icon=system-file-manager

Put the above in a plain-text file with a name like "music_browse.desktop". Give it 755 permissions. Put it on your desktop. Click it.

slakmagik 09-17-2009 05:15 PM

Quote:

Originally Posted by lutusp (Post 3687706)
It would be much simpler for you to create a desktop shortcut that launches your file browser initialized to the desired directory

This assumes he has desktop shortcuts.

Quote:

Originally Posted by AlphaLexman (Post 3687701)
I may be looking at the situation backwards but I did a mkdir /_ (just an underscore folder at the root directory)

Are you saying it would be better to link the /media/exthdd/Music/ to something else? I'm a little confused and turned around.

Okay, you can have a /_ but I don't think it's necessary or desirable. Yes, I'm saying you would probably most like to have the directory of audio files show up as though it were a directory in your home folder with all your other files.

If you really want the music to be in /_ then rmdir the underscore directory and ln -s the audio dir to /_. If you want it under the underscore directory, then don't rmdir and do ln -s to the underscore directory. But because of crypticness and permissions and so on, I just don't think it's an optimal idea. But it's your system! :)

AlphaLexman 09-17-2009 05:22 PM

Ok I tried slakmagik's orginial idea, it is close to what i want...

the ln -s ... post got me a folder in my home directory like this --

~/_/Music/Artist/...

one more nested folder than i am looking for. Maybe a little tweak to the command line?

lutusp gave me errors as I am running Xubuntu and don't have nautilus installed will it work with Thunar?

btw, root / or home ~ isn't really important as is the number of keystrokes from the command line :)
Getting closer, thanks!

GrapefruiTgirl 09-17-2009 05:23 PM

This discussion is fairly similar to an earlier discussion where the OP wished to make a "bookmark" to a certain location, so he/she didn't need to type a big long path with the `cd` command.

Maybe a bash alias is the answer here too? Though if you want a 'clickable solution' then it may not be the best idea in this case.

Check it out, just in case it suits you?

Sasha

AlphaLexman 09-17-2009 05:32 PM

Well thanks for the tip GrapefruiTgirl, an alias command may confuse other users in the house. But after giving it some thought I may actually need to use the root directory instead of my home user directory, so that the wife and son's user accounts have access to the Music also.

chrism01 09-17-2009 05:52 PM

lutusp's general idea is the right one. Get it right once, then copy to wife & son's home dirs.
The Ubuntu forums here or at Ubuntu will explain how to use Thunar. It's probably the same, just try it.
Its not generally recommended to be in the root dir for anything, especially if you are not the sysadmin.

slakmagik 09-17-2009 06:31 PM

Quote:

Originally Posted by AlphaLexman (Post 3687718)
the ln -s ... post got me a folder in my home directory like this --

~/_/Music/Artist/...

one more nested folder than i am looking for. Maybe a little tweak to the command line?

Why do you want an underscore? I feel like we're not communicating something here. If it's one too deep, remove the link and do it again. The link is like a copy command - you want "this" file linked "there". You don't need a special directory to contain the link. If you want ~/Music/Artist and the source has the structure /path/Music/Artist, then 'ln -s /path/Music ~/Music'. If you want ~/_/Artist (for whatever reason), then 'ln -s /path/Music ~/_'.

If you want the wife and son to have access, they should also have home directories with unprivileged accounts and can have links made in their home directories.

The problem with lutusp's method is that it only works from that link on that desktop. A filesystem symlink will work in every desktop, every file manager, and from the command line.

But if this is a "permanently mounted" removable drive, so to speak, then it should readable by them wherever it is. If the objective is simply to have a handy way to get it then, as GrapefruiTgirl suggests, there are multiple ways to achieve that. Unfortunately, many of those methods have the inverse problem of only working from the shell.


All times are GMT -5. The time now is 06:33 AM.