Questions tagged [symlink]

A special type of file that references an inexistent or existing file or directory. The contents of a symbolic link consist of an arbitrary string that is the path to the file that the symbolic link points to. When the symlink is encountered during pathname resolution, the string stored by the file is used to modify the pathname resolution.

Filter by
Sorted by
Tagged with
0
votes
3answers
66 views

Create symbolic links for multiple books collected from command `find`

I'd like to create symbolic links for multiple books searched from running find command. Firstly, I collect all the JS books find ~ -type f -iregex '.*javascript.*\.pdf' > js_books.md 2>/dev/...
1
vote
1answer
249 views

Create hard link if possible, else use symlink

I am trying to write a shell script to create link for file from my dotfiles repo to my home folder. I want to use hard link if possible because it cannot be broken when moving it to somewhere in ...
1
vote
1answer
114 views

Why can't a project compile with symbol link

I'm working in a team, which develops a c++ (ROS) project. For some reason, we haven't a good git management. We have several git branches. To compile the project, I have to git clone the codes from ...
0
votes
2answers
312 views

Apply readlink to a non-symlink file?

The following code from https://stackoverflow.com/a/920834/156458is to get the pathname to the parent directory of a script inside the script, even if the script is run via a symlink to it: if [ -L ...
1
vote
1answer
4k views

How to solve - Failed to execute operation: Too many levels of symbolic links on CentOs 7

I am trying to install erpNext on a CentOS 7.4 VPS and I'm following the installation script here. But I get this error during installation: Processing dependencies for pip Finished processing ...
0
votes
0answers
50 views

Can't delete a symlink from /usr/lib [duplicate]

I'm on Fedora 27. I want to delete a symlink from /usr/lib, but can't because of Operation not permitted. I'm under root and here are commands and the output: [root@thinkpad lib]# ls -al cpp ...
0
votes
1answer
53 views

Is there a tool to auto delete all invalid symbolic links?

I have a Fedora workstation, when upgrade the system some software for example LibreOffice do not delete its old symbol link in /usr/bin and when I update other software, there are a lot of warnings ...
1
vote
1answer
151 views

Inconsistent behavior of Bash's `cd` with symbolic links [duplicate]

I am currently trying understand the behavior of Bash's cd when it comes to symbolic links. By default, cd should follow the logical directory structure and should not resolve symbolic links. cd ...
1
vote
1answer
199 views

Why does udev concatenate two symlinks?

My distribution is SLES 12 SP 2. I work with DRBD (distributed replicated block device) right now. Here is an example of a configuration for a drbd resource. resource HA1dat { device /dev/drbd1; ...
1
vote
2answers
466 views

Can't delete and remove SELinux context or ACL from a symlink in /usr/lib under root

I'm on Fedora 27 and experience problems with updating the packages by dnf update. The problem is exactly as described here: https://superuser.com/q/1005740/683161 I tried to delete symlink under /...
0
votes
1answer
38 views

Read content of MS Windows shortcut from within VirtualBox

I have setup (using vagrant) a VirtualBox machine with a shared directory. I can read text files from the /media/sf_vagrant just fine. However I cannot cat the content of a file that I can only ...
0
votes
2answers
24 views

Are new output files created in symlinked directory or also in original directory?

I created a symlink to a directory but it seems that new output files from executing some analyses are also stored in the original directory - is this to be expected? From my understanding, the new ...
-1
votes
2answers
43 views

Interpreting this command

A few days ago I found the following command: for i in 0 1 2 3 4 5 6 S ; do ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done As far as understand this command is going to create a symbolic link between ...
4
votes
2answers
7k views

Using ls command with symbolic links

I currently do not understand what is going on when I try to find the contents of or information for a symbolic link to a directory when using the ls command. I understand there is an option -H for ...
0
votes
2answers
525 views

Rsync for perfect copy: softlinks become..dir

I do a "clone" from one mounted disk to other disk mounted remotely. I will cal them local and remote. Local is slackware,and remote ubuntu On local df -h /mnt/ Filesystem Size Used ...
0
votes
1answer
548 views

When downloading (using scp?) a file via symbolic link is it possible to save it under the original filename?

On a server, the directory structure is already organized like this. (For sake of argument, I can't change it. I can only figure out a way to make it more useful to me.) /work/product/versions/app-...
1
vote
1answer
124 views

Ls is showing some bash script for the dead symlink instead of a filename

This is a Symfony PHP Framework's bin/ directory, output for ls -la For some reason it is showing a bash script instead of a filename. The Linux version is Debian Stretch. This is the result of the ...
8
votes
1answer
4k views

Bash: redirect to file, always create new

In bash, a command link echo test > actual.txt will replace the contents of the file called actual.txt with "test", and create the file if it doesn't exist. However, if the file does exist, bash ...
1
vote
1answer
316 views

symlinked udev rule not working upon OS boot

I have a udev rule that mounts a certain USB device to a custom mount point under /media I confirm working, and it sits on my user's space (say /home/myuser/a.rules). And I created a symbolic link ...
0
votes
1answer
21 views

Aliasing path expansion

I've recently switched from my personal Dropbox to a company one. This means that my Dropbox folder is now named "Dropbox (Company)" from "Dropbox". Now I had all my work under my personal DB folder,...
0
votes
1answer
38 views

What could have caused a symbolic link to be deleted?

About a week ago I changed the timezone on my VPS using the following command: sudo ln -sf /usr/share/zoneinfo/US/Eastern /etc/localtime A couple of days later I get up in the morning and find the ...
0
votes
1answer
2k views

How to have tar follow all symlinks except one recursive symlink

Is there a way (in several commands if necessary) to make a tar archive that follows all the symlinks (like with tar -h) except for one recursive symlink, which should be preserved as it is? I have a ...
0
votes
1answer
604 views

Why permission denied from folder that is a symlink of a home's subfolder?

In my Fedora I have some additional HDD with partition mounted as /media/dilnix/data witch contains the most of my huge files sorted in folders like "Music", "Downloads", "Video" etc. Those folders ...
1
vote
1answer
77 views

Symbolic link does not appear to exist

MacOS here, although I'm 99% sure this is a Unix question. I'm trying to see exactly where MySQL is installed. In a terminal I enter: which mysql And I get: /usr/local/bin/mysql So I see what's ...
2
votes
2answers
273 views

Is there a simple way to recursively copy all symbolic links under a directory to another directory, preserving the structure?

I have a directory ~/tmp/foo/ that's populated with subdirectories, files, and symbolic links. $ tree ~/tmp/foo/ tmp/foo/ ├── eggs │ ├── baz │ │ └── link3.txt -> /home/me/file3.txt │ └── ...
1
vote
1answer
130 views

Paths in ln with hard links and soft links

How does the relative paths work in ln (-s or not)? For example if I type ln -s foo bar/banana.txt what does this mean? What is foo relative to? Because it doesn't seem to be relative to the current ...
3
votes
2answers
1k views

Accidentally created symbolic link to a folder in that folder

I was creating a symbolic link to folder1/folder2 in home-folder. But I accidentally did: ln -s folder1/folder2 while in folder2 instead of in home-folder. So I ended up accidentally creating a ...
0
votes
1answer
196 views

Is it possible to a shadow file in symlinked directory?

Say I've got the following directory structure: root |__A |__some_file.txt |__... |__B |__A -> root/A Where root/B contains a symlink to root/A. I want to keep everything about A the ...
1
vote
1answer
222 views

How to symlink files in folders

Iterate over files in folder and creating symlinks: I have the current script that is trying to iterate over files in a folder, and create symlinks into another folder: #!/bin/bash ##################...
1
vote
1answer
32 views

Using find to only step through symbolic links n times?

Is it possible to use find to recursively search a path but to only step through into a path which is symbolic link to a specified depth of n? There is -maxdepth but this includes regular directories ...
7
votes
2answers
512 views

How to use ls to group directory symlinks with other directories?

ls --group-directories-first displays all directories before files, but if there is a symlink to a directory, it is displayed among the files. Is there a way to group directory-symlinks with other ...
0
votes
0answers
162 views

Mount several directories in the same partition, AND hide base path

I have a computer with an SSD and an HDD. I want to put the directories that do not change often in the SSD and the ones that do in the HDD. This means keeping root / in the SSD, along with most paths ...
0
votes
1answer
73 views

How to resolve /dev/disk/by-* to device in a shell script?

In a (Bash) shell script I do wish to resolve a partition label — f.e. /dev/disk/by-label/X — to the corresponding device (partition)number: /dev/sdX1. How can I resolve a /dev/disk/by to ...
0
votes
2answers
487 views

Symlinking all dot-files and -directories

Say I have a folder ~/dot containing some files and directories, such as zshrc, Xresources, and emacs.d. How do I create symlinks to all of those in ~, but such that the symlinks begin with a dot (....
-1
votes
1answer
168 views

Broken symlink to Vim

I am trying to launch vim. I probably created a bad symlink to vim. I used which and alias commands to find out what is happening. Why doesn't it run vim properly? MacBook-Air:~ miszo97$ which vim /...
2
votes
1answer
4k views

How remove or fix broken symbolic link?

In my case this is the problem ~ $ find ./ -type l -exec file {} \; |grep broken ./.mozilla/firefox/mwad0hks.default/lock: broken symbolic link to 127.0.1.1:+3704
4
votes
2answers
2k views

Mount --bind in the same filesystem move files as in the same filesystem

If I mount --bind /a in /b and if I mv /a/bigfile /b/ it will take a lot of type (if the origin file is big). This will actually copy the file and then delete from the origin instead of simple update ...
2
votes
2answers
79 views

Faking a directory path without the full path existing

I'm working with a build system that relies on absolute paths to reference source files etc. When I want to test building with different toolchains, I mount the src directory in VMs or chroots. The ...
0
votes
0answers
141 views

Apache2 - link DocumentRoot to subfolder on external drive but alter permissions

I have an exfat formatted usb drive mounted at /media/usb/drive1/ with root user via /etc/fstab. Now I would like to link my apache2 DocumentRoot which is located under /var/www/websites/ to a ...
4
votes
1answer
946 views

How do I find symbolic links where target path matches a pattern?

I am trying to find all symlinks below current folder whose target contains 'Dropbox' My best guess was: find . -type l -iname '*Dropbox*' But this returns nothing. I want to find items such as: ...
0
votes
0answers
54 views

improve my bash script to find, remove and symlink directory tree

I have this script that I have been using for a while and it mostly works, but there are some problems I would appreciate assistance in rectifying. The goal is to look at an external mountpoint, ...
1
vote
0answers
524 views

Why doesn't Samba represent Linux symlinks as NTFS symlinks?

Samba is showing/representing symlinks as regular folders. NTFS has symlink reparse points, and these can be represented via UNC - I tried sharing the Users directory in Windows and it showed the ...
1
vote
1answer
46 views

Recursively replace all links with actual files (gnu)

In order to run Code dx on Linux files, I need to replace all links with the actual files. Haven't worked in Linux in years and am getting confused by terminology. Been searching for answers for two ...
3
votes
1answer
53 views

Get maximum level of symlinks

I would like to get the number of maximum possible symlink level in the system. I found that it is hardcoded in the kernel to be 40. But I would like to get this number dynamically, in case someone ...
2
votes
3answers
184 views

Remove symlinks originating from specific directory

I have an "install.sh" that installs my personal scripts: find /home/Steven -name '*.sh' -exec ln -s -t /usr/local/bin {} + I would like to make an "uninstall.sh" that removes the symbolic links ...
2
votes
1answer
40 views

Is there a way to get a list of symlinks pointing somewhere under a partition?

I have a mounted partition with a lot of data on it, much of it is useless, but I want to backup what is still used. I know that everything that is still in use has a symlink pointing to it, for ...
1
vote
1answer
30 views

Create soft links from multiple specific files in various subdirectories

I want to create soft links (ln -s) to folder2 of all the files that contain *foo* in its name, and can be found in some or all the subdirectories of folder1. I've tried it with for, find, and find -...
-1
votes
1answer
879 views

How to create softlink for a file /var/log/messages on /root/Desktop with same name using ln command

Which one should be the target and which one be the link name? Update 1: I am logged in as super user, and I also got to know to access root folder using GUI.
0
votes
1answer
337 views

How to chdir to symlink source and not target in .screenrc

Is there a way to tell screen not to dereference symlinks when one is passed to the chdir command? In my .screenrc I have commands like this: chdir /data/project1 screen -t "project1" chdir /data/...
1
vote
1answer
130 views

Symlink permission issue on Linux + ZFS

I have two symlinks pointing to the same target directory. ls shows one of them (the bad one) belonging to the 1001 user, the other to root. Any user other than 1001, even root, can list the directory ...