How to make a symbolic link on the command line
Hi, the path to one of my folders is pretty long:
cd here/here/here/here/here/here I was wondering if there's a way to make a link (in a terminal) so I only have to type in: cd here to get there Thanks! |
yep, can be done
make a folder called "here" mount the folder Code:
mount --bind /here/there/somewhere/else /here Edit - an extra entry in the fstab should do... |
Code:
ln -s here/here/here/here/here/here there Notice I used a relative path (as you did). But you might want an absolute path depending on where the link is and how it is used. Various mount operations (as Thor_2.0 suggested) might be better alternatives in some situations. But I don't see any hint in your original post that a mount would be better than a symbolic link. For things you need to type in a lot, using an environment variable, and alias or a script is usually better than a symbolic link or mount: Code:
export there=/absolutepathto/here The word export in that first line may not be necessary, depending on how you use "there". |
In a terminal in your /home directory
Code:
ln -s here/here/here/here/here/here here Code:
cd here then Code:
cd |
Thanks for the immediate replies.
Thinking things through, perhaps I should tell more. I have a mounted external HDD. I've already changed all the links to ~/home/Documents (etc) to point to the same folders on the external HDD. I use nemo to get to these folders. The original folders in home are still there and get used sometimes. They're backed up daily to the duplicate folders on the HDD. The problem I'm facing is that I constantly have to change directories to the external HDD or type in an absolute path to either open something or look at the contents of a folder. For example, if I want to confirm the naming convention of a folder in my software directory on the external HDD I have to type: ls /run/media/win7/storage/Software (don't ask me why it's called 'win7' please) From any prompt location in the CLI, I would simply like to type in: ls /here/Software to get a directory listing. Similarly, making a directory in Software before wgetting a file and then wgetting the file to that location would be easier if I had some sort of symbolic link too. Do I have to actually make a folder to represent the location since the location already exists? The external HDD is already auto-mounted on boot. I am new to this, and trying to move over to the CLI instead of GUI, so please be gentle with your answers and assume I'm a noob who doesn't know how to do anything. Thanks. |
OK. I just used:
Quote:
johnsfine, I'm not sure how to make a batch script or where to put it (F21). Can you give instructions or point to some? Thanks |
Quote:
create a script that mounts the folder, and in the future, you can add more stuff...add this to the crontab as @reboot It is one option, there are more enlightened ones that may have something better than that... Thor |
All times are GMT -5. The time now is 10:44 AM. |