Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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
2
votes
2answers
330 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
169 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
215 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
272 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
555 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
184 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
82 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 ...
1
vote
2answers
551 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
187 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
5k 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
90 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
158 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
1k 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
571 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
47 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
62 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
218 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
42 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
32 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
1k 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
356 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
137 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 ...
1
vote
1answer
208 views

How to view MATLAB livescripts?

When I try to open a matlab livescript inside the default DE, I get an error that says: Viewing MATLAB Live Script files is not currently supported by this operating system configuration. For more ...
0
votes
2answers
45 views

Obtain list of directories in hierarchy, which contain only symbolical links

I'm aware of various tools available to obtain a list of directories in hierarchy, which contain only symbolical links, but I am not proficient enough to invent a solution myself. Personally, I will ...
0
votes
2answers
189 views

Linux Symlink Traversal Issue

I am trying to use a USB PENDRIVE to increase my current path for building a large library. So, I have this idea of creating a symlink in my program to a folder in the Pendrive. So that it uses the ...
1
vote
1answer
143 views

Source control and symlink for .zhistory

I symlink dot files from my home directory to actual files in a separate folder that is under git source control. This works great, but for some reason I am having problems with .zhistory. $ echo $...
2
votes
1answer
2k views

Creating a copy of a file, that gets automatically updated

I'm using Fedora 26. I want a script to run at startup, but also have this script in my scripts folder. How can I make it so the /etc/init.d/foo gets updated when I edit ~/scripts/bar? I was thinking ...
2
votes
1answer
630 views

How to bind mount from a symlink

This is similar like How do I do a bind mount over a symlink? But here the question is how to do a mount --bind from a symlink? I have /linux-4.13.0 and a symlink linux pointing to that: /linux -> /...
1
vote
0answers
407 views

Symlinks not working on GlusterFS Fuse mount

I am running GlusterFS 3.11.3 on CentOS 7 64-bit in an OpenVZ environment. Since I am not the datacenter owner and the OpenVZ hosts don't allow sys_admin privileges to virtual machines, I have ...
5
votes
1answer
913 views

Apache can't open file that is a symlink

I have a file: js/jquery.terminal-src.js: symbolic link to ../../repo/js/jquery.terminal-src.js and when I try to open it with browser using: http://localhost/projects/jcubic/terminal/test/js/...
1
vote
2answers
8k views

ls shows a directory but it is inaccessible

I was trying to copy one folder from one location to another. The folder is about 6.4 Gb. So I did cp -r source_folder level1/val after that, I went into the level1 folder and checked: level1$ ...
6
votes
2answers
3k views

Info on cp --preserve=links

I'm trying to understand what cp --preserve=links does when used by itself, from my tests it seems that it copies a normal file normally and dereferences symlinks, but it seems like it just has the ...
0
votes
1answer
38 views

Command run is not the one returned by the command `which` [duplicate]

$ which doxygen /home/gauthier/bin/doxygen $ $(which doxygen) -v 1.8.13 $ doxygen -v 1.8.11 # <- ??? $ doxygen error: Doxyfile not found and no input file specified! Doxygen version 1.8.11 ...
1
vote
0answers
242 views

Nvidia Opengl symlinks

Last NVidia update in the Debian unstable branche (375.82) broke the symlinks of the openGL libs. LIBGL_DEBUG=verbose glxinfo|grep libGL: screen 0 does not appear to be DRI2 capable libGL: ...
0
votes
2answers
204 views

/sbin/mkfs.fs acts like a binary file even though it's a symbolic link file

Considering the output from the ls command: $ ls -l /sbin/mkfs.ext4 lrwxrwxrwx 1 root root 6 Aug 4 00:10 /sbin/mkfs.ext4 -> mke2fs $ type mkfs.ext4 mkfs.ext4 is hashed (/sbin/mkfs.ext4) mkfs....
1
vote
0answers
50 views

Automake distcheck of symlinked sources

I maintain a "master" makefile for a project with many submodules, each of which has its own autotools structure. This project is tested in a number of configurations (e.g. built against different-...
2
votes
1answer
230 views

Why symbolic links have no data blocks allocated to them in ext4fs?

I am a Unix wanderer. I just noticed that symlinks don't have data blocks allocated to them, I think the inode of the symlink file stores the filename which the symlink refers to, is this actually the ...
0
votes
1answer
2k views

rsync copy symbolic links files in root folder without copying symbolic links recursively within the root folders

I am trying to set up a script for copying symbolic links folder data and my idea is to set up a single folder and to create several symlinks in this folder where the rsync will then copy the data ...
2
votes
3answers
224 views

Switch symlink and directory

I have a directory and a symlink to it: mkdir dir ln -s dir dir_symlink I want to replace the symlink with the directory and the directory with the symlink. Is there a way to do that atomically (or ...
2
votes
2answers
205 views

Why can a softlink to a directory be created with or without the trailing slash?

I have found that when creating a symbolic link to a folder it is produced with or without the trailing slash based on your input. for example: $ ln -sfv /ln-test/FOLDER/ test-tail test-tail -> /...
2
votes
0answers
696 views

Nested Mount Best Practice

I have two filesystems that need to be mounted on a RedHat system /apps and /apps/label. /apps will have several sub directorates and label will just have files FTP'd to it. Would it be better to ...
6
votes
4answers
920 views

How to create a symlink which opens (literally) the target file

Suppose I have a file bar.txt inside directory foo and create a symlink baz.txt to foo/bar.txt. Like: ./foo ./foo/bar.txt ./baz.txt -> foo/bar.txt If I open baz.txt my editor will think baz.txt ...
0
votes
1answer
485 views

how do i link one directory to another directory so that FTP or SMB share can still use that directory

Needing to link a SMB share directory to a empty directory with a FTP share. There is a empty directory inside of FTP_Share1 called smbshare which I am trying to link to SMB_Share1 to access all of ...
0
votes
1answer
283 views

Symlink to /sys/bus/spi/devices

I'm trying to port a certain software from one linux device to another. My software has a lot of lines pointing to /sys/bus/spi/devices/spi3.0. In the Linux device I'm porting to, that folder does not ...
1
vote
1answer
2k views

Symbolic link to jar file and init.d service

I am following the instructions in the "Installation as an init.d service (System V)" chapter of the Spring Boot Reference Guide. I am not able to create a symbolic link to my Java app in init.d on ...
0
votes
2answers
312 views

Symlinking /mnt in a VM to compile file directly to VM folder

What I'm trying to do is symlinking a shared folder between my Mac and my Ubuntu VM. The shared folders on the VM are going in /mnt/hgfs/. On my Mac I symlink the directory (let's say macdirectory) ...