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
1
vote
1answer
890 views

Is it possible to make a symbolic link of a file in other machine?

I have a account in a server and I would like have a symbolic link of some files in my local machine. How can I do this?
128
votes
8answers
53k views

Why are hard links to directories not allowed in UNIX/Linux?

I read in text books that Unix/Linux doesn't allow hard links to directories but does allow soft links. Is it because, when we have cycles and if we create hard links, and after some time we delete ...
11
votes
5answers
31k views

How to copy symlinks as symlinks from one machine to another?

Let's assume I have two identical systems. On the first system I've created a symbolic link. On the second one I want to copy that symlink via sftp and the symlink shall work the same (i.e if the ...
0
votes
1answer
14 views

Symlink on remote file server to refer to file on local machine over sshfs

I have an sshfs mount to my file server. In the mounted directory there is a symlink that points to /tmp/localfile. /tmp/localfile does not exist on the remote server, but does exist on the local ...
0
votes
1answer
27 views

Recursive Symbolic links

I want to drop through my mp3 folders and create a sym link to each mp3 in a folder called links. I would like for my links to be relative to the directory structure rather than absolute. I tried this ...
1
vote
2answers
41 views

What sort of file thing do 'namespace files' point to?

I was poking around /proc/*/ns, and noticed that namespace files look unfamiliar: # example from `man namespaces` $ ls -l /proc/$$/ns total 0 lrwxrwxrwx. 1 mtk mtk 0 Apr 28 12:46 cgroup -> cgroup:[...
9
votes
1answer
2k views

Can GNU Stow use a stow directory that is a symbolic link?

Consider this script. #! /usr/bin/env bash mkdir -p target mkdir -p mydir/package/ touch mydir/package/file ln --symbolic mydir mylink file mylink stow --verbose --dir=./mylink --target=./target ...
1
vote
1answer
18 views

Linux: synchronize directories via symlinks

I have two directories, say A/ and B/, each with their own subtree. I'd need to synchronize the content of A/ with the content of B/. The result I need is similar to recursively copying the subtree ...
0
votes
1answer
31 views

run a software with input file as symbolic link

I have a directory with thousands of files, and I want to run a software multiple times in different directories with the same input files without copy the input in each directory, I have created a ...
0
votes
1answer
23 views

Link files and directories, in target directory, with cross-device links

I have a user account at my local library (they use openslx), in which I can store files. My actual home folder is "mounted" (I'm not sure how) in /home/[my_userID]/PERSISTENT instead of /home/[...
11
votes
2answers
606 views

How to define a symbolic link that I can use in every directory

Is it possible to set a symbolic link so that I can use project to point the directory home/me/project, e. g.? This should be independent of the location in the file system. I'd like to use commands ...
0
votes
2answers
32 views

Convenient way to cd into a frequently-used dir? [duplicate]

A dir I cd into a lot has a really long path. I'd like to reduce keystrokes. I have tried this... sudo ln -s /mnt/c/Users/me/ho/hum/bin /mybin It works, but something about it seems wrong. Is ...
0
votes
1answer
51 views

How can a single file system object be both a symlink and a directory?

When I ls it, it's a directory with a bunch of files in it. But when I ls -l it, it's a symlink to something that's NOT a directory. What's going on — how is it possible? $ ls /sys/class/net/...
1
vote
1answer
26 views

mariadb.service - linking unit aliases mysql.service & mysqld.service - (why) is it necessary

I cannot find the originally site I found how to set up MariaDB on linux. Dependend on that tutorial I wrote an ansible playbook. While refactoring my playbooks I found those two tasks. - name: ...
2
votes
1answer
1k views

Symlink all files in a directory with the entire directory tree

Right now I use this ln -s /dir/* /dir2/ Which will symlink everything, but I have to go inside the dir and make a new directory because the folders are also symlinked (this is expected). So here ...
0
votes
3answers
30 views

How to completely uninstall java from RHEL?

When I do which java I get the following output: which java /dir/java/bin/java I have already uninstalled java rpm using the following `rpm -qa | grep -i java` rpm -e rpm-name Still java is not ...
28
votes
5answers
14k views

Convert absolute symlink to relative symlink with simple Linux command

I have a complete sub-filesystem inside a path /home/user/system containing the standard Linux structure with directories /bin, /home, /root, /usr, /var, /etc,... This sub-filesystem contain symbolic ...
1
vote
1answer
33 views

Safely remove a symlink or hardlink

Does using rm on a symlink or a hard-link remove the source in addition to the link? Is there a good way to delete a hard-link or a symlink without deleting the source? And if there is a good way ...
48
votes
7answers
33k views

Find only destination of symlink

For use in a shell-script, I'm looking for a commandline-way to get the destination of a symbolic link. The closest I've come so far is stat -N src, which outputs src -> dst. Of course I could ...
0
votes
1answer
2k views

What is the difference between “find -H” and “find -L” command?

When I executed the command both commands gave the same output. I created a soft link and a hard link for a file but still both commands gave the same output. Is there a difference between find -H and ...
0
votes
1answer
25 views

Symlinks with grub2 like pxelinux

I do want to do symlinks like pxelinux can, just with grub2. But I cant figure out how. The goal is to have different config-files which I can dynamicly pass to an IP. Grub2 does work so far but I ...
0
votes
1answer
53 views

Difference between file descriptor and soft/hard link

If soft link and hard link are pointer to a file. And file descriptor is a file handle pointing to an open file. Then what exact difference is between the two if both of them are a kind of pointer ...
0
votes
1answer
26 views

Rsync keep full symlink directory structure

So, I am trying to keep the synlink structure when transfering files, so my folder structure: $HOME/backup/backup/symlinks - $HOME/Documents/hello.txt $HOME/backup/backup/data Now, when I sync I ...
1
vote
1answer
35 views

Is there a way to create a symlink to a non-existent target?

Is there a way to create a symlink whose target does not exist using shell scripts? From reading man 1 ln, I do not see an option to do so; and even -f checks if the target exists. Is there a way to ...
2
votes
1answer
64 views

Why can't I access a symlinked directory

I want to (soft)link my .thunderbird dir onto the actual directory which is on a SD card. Thus, (xenial)florian@localhost:~$ ls -la /var/host/media/removable/SD\ Card/.thunderbird/ total 24 drwx-----...
3
votes
2answers
2k views

`ls` Attemptes to list nonexisting symbolic links on WSL

I have clean installed windows 10 (build 1803). I have installed Ubuntu from the Microsoft Store and enabled Linux subsystem. I have done this several times in the past, and never have I had the ...
1
vote
1answer
28 views

Create a directory if it doesn't exist when symlinking a file into that directory

Assume I want to symlink like in the following command: ln -s /home/user/dots/cmus/cmus.theme /home/user/cmus/cmus.theme But for the above command to work, I need to make sure that the directory /...
2
votes
0answers
39 views

Automatic symlink to latest folder

Is there a way in Linux to automatically maintain a symlink to the latest version of a file/folder in a certain location? My use case: I generate datasets with unique job names, then write them to a ...
19
votes
3answers
60k views

Java location from /usr/bin/java

I'm trying to find my java location within my Linux system and got this [980@b449 ~]$ which java /usr/bin/java [980@b449 ~]$ readlink -f $(which java) /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/...
-1
votes
1answer
22 views

access soft symlink directory's contents in bash [duplicate]

I have a bunch of symlinks pointing to various directories. Each of the target directories happen to have a space in them, I have not created them like that, but they are being received as such via ...
41
votes
5answers
51k views

How can I remove all symbolic links with a special target?

With the command: ls -la * I can list all my symbolic links. How can I remove all symbolic links which are linked to a special folder? For example: In my directory usr/local/bin I have the ...
0
votes
0answers
54 views

weird symbolic link

I found a weird symbolic link shown below. 1st line looks fine, but 2nd line(starting with ->) is weird. Is this normal? If not, how can I fix it? lrwxrwxrwx 1 kcc-2 asp2 37 05 May 23:53 ...
9
votes
3answers
15k views

How does linux work with symbolic links?

I mean what's going on when some process wants to read a symlink? What's going on when something changes a symlink during a read or even write process? For example: I have 2 huge, similar 100G files /...
1
vote
1answer
3k 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
1answer
54 views

Make a `ln -s` that checks for broken symbolic links

I am trying to write a function ln() (if it is not a good idea to call it ln, it may just be as well called myln() or whatever, but that is not important) in bash, such that, If the short option -s ...
51
votes
3answers
39k views

How can I “relink” a lot of broken symlinks?

I have a directory tree which has a bunch of symbolic links to files under /home... however, I have moved /home to /mnt/home and need a way to "relink" all of the symlinks. Does such functionality ...
0
votes
1answer
43 views

A command to know if some file are “only” an hard link and “not” a symlink [duplicate]

I need a command for an if condition to know if 'file_name' is an hard link (not symlink). Thanks
2
votes
1answer
49 views

I need a command to know if a file is linking to another file

How I can know if file1 is a symbolic link to a file2? I need an if condition.
0
votes
1answer
51 views

Why are Linux namespace links in /proc red in color?

I inspected the symlinks in an Ubuntu VM for the namespace related directories under /proc/PID/ns. I see all the links are in red color. I even tried to test using unshare to see if I can create a ...
17
votes
4answers
32k views

Finding the original file of a symbolic link

So let's say I have a symbolic link of a file in my home directory to another file on a different partition. How would I find the target location of the linked file? By this, I mean, let's say I have ...
3
votes
0answers
316 views

Why does conda not use symlinks for duplicate dependencies? [closed]

I wondered whether conda actually made duplicate files for certain dependencies shared by independent environments. I installed two environments env1 and env2. Then I installed the same module ...
1
vote
1answer
50 views

unlink/rm target of an open symlink

I've come across an issue where processes that load symlinked .so files crash if I update the .so while the processes are still running. I have long-running processes that load shared libraries (.so)...
6
votes
1answer
6k views

In Ubuntu, is there a way to virtually merge two folders without unionfs or aufs?

I've got a source control system at work that I can't modify which scatters a bunch of files in unfortunate places. My IDE expects these folders to be in a single unified location. Normally I'd just ...
1
vote
1answer
185 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; ...
0
votes
1answer
12 views

File popups freeze in specific directory and show nothing - how to fix?

I had this issue for months. Whenever I moved to my home directory within a file popup (from both qt and gtk), the window freezed and I could neither close it nor move to another directory. I just had ...
1
vote
1answer
8k views

soft link vs. hard link

What does that mean that a soft link can cross file system boundaries ? Does that mean that I can create a soft link on a ext3 to a file on a ext4 files system ? Also, while I understand (at least I ...
4
votes
1answer
468 views

Using symbolic links and git to manage build versions

In general I follow the following workflow when I build any program (e.g. emacs, tmux, etc.) /home/opt/[name of the program]/builds/[version]/ bin lib share For example for a program like tmux I ...
0
votes
1answer
30 views

Debian - Restore a Timezone File [duplicate]

So, I just screwed up a timezone file on my Debian system because I pointed it as a link to /etc/localtime vs. pointing /etc/localtime to it. Specifically, /usr/share/zoneinfo/America/Puerto_Rico. I'...
0
votes
2answers
62 views

Is it possible to “add” a second folder to the current folder file contents? symlink?

question: Is it possible to "add" the contents of a 2nd folder to the current folder file contents? (In essence I was asking from a full Unix is perspective but may be nginx would work too as the goal ...
0
votes
1answer
14 views

Symbolic Link Restores Original File

On Linux, I created a file (file1): echo Hello file1 > file1 Then, I created a symbolic link (file2), to file1: ln -s file1 file2 After that, I removed file1: rm file1 Lastly, I edited file2 ...