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
3 votes
1 answer
237 views

Use the parent directory from the symlink instead of where the directory actually resides on the filesystem

So let's set up the context. Two paths: /some/very/convoluted/path/name/the-wanted-directory /myhome I create a symbolic link in /myhome and then cd into it: /myhome $ ln -s /some/very/convoluted/path/...
user avatar
  • 973
1 vote
2 answers
391 views

POP!_OS - Python3-repolib Error on Upgrade

POP!OS_22.04 TL;DR Ran into a weird error with a specific package python3-repolibon Lenovo Laptop. This also happened this morning on my partner's iMac device after she attempted to upgrade to 22.04. ...
user avatar
  • 11
0 votes
2 answers
38 views

Printing full symbolic link information, starting from a root directory

We are interested in printing all the symbolic link information, starting from a root directory. We would like the information to be printed in the following format: symbolic name -> actual name ...
user avatar
  • 137
2 votes
0 answers
25 views

What do the permissions mean in /proc/<pid>/fd/?

I'm looking at the result of running ls -l on /proc/<pid>/fd/: lr-x------ 1 root root 64 Apr 22 23:13 0 -> /dev/null lrwx------ 1 root root 64 Apr 22 23:13 1 -> 'socket:[19700]' lrwx------ ...
user avatar
0 votes
1 answer
17 views

Mount ONLY specific extensions using --bind option? Or alternatives... (Idk if is this possible... )

I have a folder in a partition with lots of files - PDFs, texts, logs, etc. The folder is /mnt/main_files I'm wondering if is it possible to map only the PDF files and direct them to /var/www/html/...
user avatar
-2 votes
1 answer
62 views

What are the implications of adding "./" to relative symbolic links?

I noticed that when I create relative symbolic links, starting the source path with ./ keeps it that way and starting with an alphanumeric character keeps it that way, despite them both meaning the ...
user avatar
  • 219
0 votes
0 answers
27 views

What does default -> /etc/nginx/sites-available/default mean?

I am looking at nginx/sites-enabled folder lrwxrwxrwx 1 root root 34 Mar 31 11:52 default -> /etc/nginx/sites-available/default What does default-? denote?
user avatar
1 vote
2 answers
39 views

How to write script to update symbolic link of libraries (multiple files)

Would like to enquire on how to write symbolic links for multiple files? like writing a bash script Basically the file is gstreamer library, the library is of such patterns. An example is as of below ...
user avatar
2 votes
1 answer
56 views

Why use relative symlinks in the root directory?

I have a question about symlinks in (or very close to) the root directory. My kernel version is 5.16.11-arch1-2 at the moment. When I run ls -l / it prints this: lrwxrwxrwx 1 root root 7 Dec 6 ...
user avatar
0 votes
1 answer
41 views

What is '..' really represent for?

centos version :8.5.2111 I am now at this pwd : /tmp/new/ I need to create a soft link between /home/chenchen/Videos/ and /tmp/softlink Here is my command: ln -s /home/chenchen/Videos/ ../softlink ...
user avatar
18 votes
2 answers
2k views

I've copied a directory with `cp -as` and now I'm terrified to `rm -rf` the created directory as it might delete the original

I've copied a directory with cp -as /media/user/dir symlinks and now I'm terrified to rm -rf symlinks as it might delete files in /media/user/dir What is the safe way to only delete the directory ...
user avatar
  • 299
0 votes
1 answer
46 views

Reasonable way to customize ( change ) an executable program's command ( name ) , in terminal

Background Using xfce4-terminal as an example, I want to run the program by just typing term. When I type which xfce4-terminal it returns /usr/bin/xfce4-terminal. So, I created a symbolic link: sudo ...
user avatar
  • 357
0 votes
1 answer
59 views

/usr/lib vs /etc/ld.so.conf.d

TL;DR Why is it better to place a symlink to a shared library at /etc/lib(64)/ or why is it better to create a *.conf file in /etc/ld.so.conf.d/ .conf file Assuming i have my custom binary at /opt/...
user avatar
  • 5
6 votes
3 answers
524 views

"cd" to symlinked directory, want current working directory to be full path

In my home directory ~, I issued ln -s Subfolder1/Subfolder2/Subfolder3 I then have a soft-linked folder Subfolder3 in my home directory.  When I pushd into it, both pwd and dirs show my current ...
user avatar
1 vote
2 answers
57 views

Remove directory, except when pointed to by symbolic link

I have the below directory structure. I need to find the directories in which a file called log.xml exists and remove all of them completely, except the directory which is pointed to by a specific ...
user avatar
  • 13
1 vote
1 answer
30 views

Does a symlink from a wxallowed mounted partition apply wxallowed when the target is a partition without wxallowed?

If I configured the following symlink: /usr/local/symlink@ -> /var/target/ Using default disklabel partitions, is the wxallowed mount option applied to the target?
user avatar
  • 423
0 votes
0 answers
176 views

Kernel module build can't find find symlink folders: Makefile: No such file or directory

I have a simple kernel module that creates a reverse shell. I created my Makefile like that: cat << EOF > Makefile obj-m +=${module_name}.o all: make -C /lib/modules/$(uname -r)/build ...
user avatar
  • 281
0 votes
0 answers
409 views

Undefined symbol after updating thc-hydra

I was using hydra without any issues until I decided to update it. Right now when I'm trying to run hydra I'm getting this error: hydra: symbol lookup error: /lib/x86_64-linux-gnu/libmongoc-1.0.so.0: ...
user avatar
  • 1
-1 votes
2 answers
53 views

Create symlinks with wildcard

I'd like to create a symlink with a wildcard : ln -s jetty_server01.file jetty_*.file So all requests to a file named jetty_*.file will link to target jetty_server01.file, in the same directory. Is ...
user avatar
  • 301
1 vote
1 answer
48 views

ln: create relative symlink to a relative symlink

I want to create a relative symlink pointing to a relative symlink, not to the relative symlink's target. It seems that when creating a relative symlink ln resolves TARGET instead of pointing to the ...
user avatar
  • 497
1 vote
1 answer
40 views

Symlink to random cat image

Say I had a folder full of cat images. I'd like to create a symlink that points to a random cat from that folder and changes each time the symlink is accessed. I suppose I could create a script that ...
user avatar
5 votes
4 answers
568 views

How to find the final excutable file path using file command?

I am using Ubuntu 20.04, and I usually need to find the final executable path for a given command. Let's take awk as an example: file $(which awk) # Output: /usr/bin/awk: symbolic link to /etc/...
user avatar
0 votes
0 answers
12 views

Embedded Linux - replacing symbolic linked file not updating

I am troubleshooting an embedded Linux system. There is a program, let's call it foo. It is symlinked to a super program, let's call it bar, similar to busybox. #ls -l foo lrwxrwxrwx .... foo -> ...
user avatar
  • 179
0 votes
1 answer
56 views

When should you use absolute pathnames when creating a symbolic link?

I have read here and in few books that making symbolic links using relative pathway is preferred because if you move link and file, it won't break. I wondering if we should always create relative ...
user avatar
  • 115
7 votes
1 answer
1k views

Why does this new directory have a link count of 3?

$ sudo su # dd if=/dev/zero of=./myext.img bs=1024 count=100 . . . # modprobe loop # losetup --find --show myext.img /dev/loop0 # mkfs -t myext /dev/loop0 . . . # mkdir mnt # mount /dev/loop0 ./mnt # ...
user avatar
  • 173
0 votes
0 answers
35 views

Suggestions for issues with symbolic links

I love symbolic links. They allow me to reference a file from multiple places in my file system, use convenient names to refer to files with complex file names in a transparent manner (rather than ...
user avatar
1 vote
1 answer
119 views

Is symbolic link to hardlink (inode) of directory possible? (that would point to the same physical location after mount on top of that directory?)

Some time ago I wanted to be able to access files in a directory which was overshadowed by later mount point. I recall finding several QAs on SE giving answers, but I recall none I've tried worked. ...
user avatar
0 votes
1 answer
21 views

How to search over symbolink links for the existence of a file?

As a follow up on this question, I am trying to determine which command/sequence of commands can give me which of the network interfaces listed under /sys/class/net is the wireless one - by searching ...
user avatar
  • 298
1 vote
3 answers
378 views

rsync : Copy symlinks as regular files

I need to copy a large directory containing all kinds of files onto a drive that already has a lot of important data. I'd like to be able to copy munged symlinks but the drive is exfat and symlinks ...
user avatar
  • 121
1 vote
1 answer
128 views

Copy folder with scp that contains links

How can I copy a folder with scp that contains links? When I use the -r flag, all the data where the links point to are copied. How can I copy the link itself?
user avatar
0 votes
0 answers
25 views

Copy symbolic file source (origin) with Ctrl+C and nemo - Linux Mint

cp -L copy source of symbolic files, instead symbolic file itself, and for cp is standard parameter. I want to make this way for copy standard, for mouse copy in nemo (Linux Mint file manager) and ...
user avatar
2 votes
1 answer
29 views

rsync behaving oddly with symlinks

I've discovered tonight that some rsync backups aren't quite working as intended. For info, we're using rsync version 3.1.2, with options -rulv. In short, on one of our server's HDDs we have ...
user avatar
  • 51
0 votes
0 answers
49 views

SymLink to WordPress themes folder doesn't seem to work

I am trying to build myself a custom WordPress theme using underscoretw. Theme location is: /home/j/code/mechanic360/wordpress_theme/mechanic360/theme And the nginx powered, local WordPress site sits ...
user avatar
  • 275
1 vote
0 answers
20 views

Loop over directories, where name of root dir is retrieved from a variable [duplicate]

There are tons of example out there that show how to loop over directories in a directory with bash. However, I encounter the problem, that the root directory, which is retrieved from a variable, is ...
user avatar
1 vote
1 answer
64 views

How do I write a script that creates symbolic links of files found inside folders in source directory to another directory

I'm fairly new to Linux and I have used batch files to do batch tasks easily. I have this script that scans the folders found inside the source folder and then creates a symbolic link off each ...
user avatar
9 votes
1 answer
311 views

Why does ".." in a symlinked directory in Linux reference the "incorrect" directory? [duplicate]

Please, try to run the following script: #!/bin/bash mkdir a mkdir a/asub mkdir b ln -sfr a/asub b/bsub touch a/this_file_is_in_a touch b/this_file_is_in_b cd b/bsub echo "I'm in directory: $(pwd)...
user avatar
  • 333
0 votes
1 answer
35 views

NetworkManager & Symlink interface names

I have a Nimbelink modem that enumerates as 4 ttyUSB devices. I'd like to have persistent interface names so NetworkManager can control the ppp0 connection (need to use the 3rd ttyUSB of the 4). I've ...
user avatar
  • 1
0 votes
1 answer
42 views

Hard link to soft link

Can one force ln not to follow a soft link in its first argument? For example, in the following I would like hard to be a hard link to the soft link soft: $ mkdir dir $ ln -s dir soft $ ln soft hard ...
user avatar
  • 1
0 votes
2 answers
280 views

tar fails on symlinks when called as python subprocess

After upgrading my debian from buster to bullseye, my yocto build process fails in do_package: Function failed: perform_packagecopy with hundereds of messages like tar: ./dir/linkfile: Cannot change ...
user avatar
  • 11.1k
0 votes
0 answers
21 views

File manager that shows the actual path in the location bar after following a link

I'm looking for a Linux file manager that shows the "actual" path (as printed by pwd) in its location/address bar when following a link. When I open links on my desktop (say in thunar), the ...
user avatar
1 vote
1 answer
1k views

CentOS: Failed to create symbolic link error - no such file or directory

So I have a tar.bz2 folder called 'project' that I extracted in the directory /home/eric I'm asked to make a symbolic link /src/project which points to the directory where I untarred it. The given ...
user avatar
0 votes
3 answers
136 views

How to make a link to have the same timestamp as the target file

Suppose you have file file with a given mtime. If I create a symlink sym pointing to file via ln -s the symlink itself gets a mtime-stamp that corresponds to the time where the symlink was created ...
user avatar
  • 16.7k
0 votes
2 answers
102 views

How do I list the contents of a directory excluding symlinks and their pointers?

I have a directory where applications are installed and symlinks are updated to point to the latest version. This leaves lots of old directories around that aren't used because there is no symlink ...
user avatar
11 votes
2 answers
729 views

cp command follows symlink at target and obliterates file instead of overwriting symlink

I have a symlink sd/common.py -> actual_file I would like to replace the symlink with a generated file, but when I do: cp /tmp/Star_Wrangler/common.py sd/common.py It copies from common.py and ...
user avatar
0 votes
1 answer
39 views

Will I lose all mounts and symbolic links if I resize partitions with gdisk in Linux/Android?

I have a rooted Android tablet running Termux terminal. The device has 32gb built-in storage. 6gb is partitioned for "Internal Storage" and is used for apps/games/documents and such. 23gb is ...
user avatar
1 vote
1 answer
51 views

Why can't I symlink a preexisting file to a target file? [duplicate]

I have an example to better illustrate what I'm talking about: $ touch tas $ ln -s /etc/leviathan_pass/leviathan3 /tmp/l2/tas ln: failed to create symbolic link '/tmp/l2/tas': File exists Basically I ...
user avatar
  • 11
0 votes
1 answer
39 views

Make a link to external file behave as the file itself (i.e. delete the link target, not the link)

I have Arch installed on an SD card (F2FS) that is rather sparce in terms of disk space. There is also an original laptop's NTFS Windows SSD drive that has much more free space and is much faster. I ...
user avatar
0 votes
0 answers
73 views

How to treat a symbolic link as a file itself (instead of the one it points to)?

Out of curiosity i wanted to open a symlink as itself instead of the file it points to, just to see how it looks like. While there are ways to see what file it points to like using readlink and ways ...
user avatar
5 votes
1 answer
278 views

Partially resolve/follow symlinks when globbing in zsh/Bash

Assume I have a file a which is a symlink to b, which in turn is a symlink to c. With zsh's :A modifier, globbing a will result in an absolute path, resolving all symlinks, hence a(:A) will expand to ...
user avatar
0 votes
0 answers
30 views

Is there a way to allow a directory only to contain symbolic links?

I was wondering if there was a way to allow a directory only to contain symbolic links, but no standard files or directories. I want to get permission denied if a file is not a symbolic link. Maybe ...
user avatar
  • 148

1
2 3 4 5
22