Questions tagged [ln]

ln - Command line tool to create hard links to existing files and soft links to existing and non-existent files.

Filter by
Sorted by
Tagged with
0
votes
1answer
20 views

How to correct a link… Or is it a GNOME Desktop menu entry?

Few days ago, I've downloaded IntelliJ in my Downloads folder. I've executed bin/idea.sh installed it, and a convenient icon became available in my GNOME Desktop named IntelliJ, and was shown whenever ...
0
votes
0answers
37 views

Move files & folders and Symlink

I am looking for a way to exclude some files/folder and mass move files/folders with spaces and special characters from source to destination and then symlink after move completes. So far I have ...
0
votes
1answer
37 views

Why does ln -s create a directory if soft-link exists?

I ran this command ln -s /folder1/dir /folder2/soft_link which did create a soft-link file where /folder2/soft_link pointed to /folder1/dir. But I notice when I run that same command again, it ...
0
votes
1answer
22 views

Create a symbolic link containing certain subdirectories

Assuming I have the following directories: /source/dir1/sub1 /source/dir1/sub2 /source/dir1/sub3 /source/dir1/sub4 /source/dir2/sub1 /source/dir2/sub2 /source/dir2/sub3 /source/dir2/sub4 ... (...
0
votes
0answers
24 views

How to copy files from linux rhel6 to another rhel6 (which are not connected)?

How to copy files or folders from linux rhel6 server to another (which are not connected) with same file or folder properties (especially symlinks) using zip? The only way is FTP to server1 and copy ...
0
votes
1answer
68 views

What does the -fs flag do in the ln command?

came across this line in a code base today ln -fs /tmp/Cargo.lock . and I couldn't find the -fs argument anywhere in man ln. What does it do? P.S. The project runs this command inside of a docker ...
1
vote
0answers
20 views

Is there a path length limit for the soft link in ext2 file system?

I am working on a project for the educational purpose which I wrote an ln Linux command in c for the ext2 file system. I was trying to handle the case where the length of the src path for ln -s is ...
0
votes
1answer
906 views

ls -a lists files with “->” arrow I think they are linked how can I make my new file to change when referenced file is changed?

I have following files: dirA/reference-file.ts dirB/new-file.ts I want new-file.ts to always change its content to match exact content as reference-file.ts when reference is changed. For example ...
1
vote
1answer
1k views

what is `ln --no-dereference` suppose to do?

I'm refreshing my understanding of a few basic GNU/Linux commands that I admit that I never really understood fully for the last 20+ years. $ man ln in part says: -n, --no-dereference ...
0
votes
0answers
58 views

How to overwrite existent folder by create a symbolic link with the same name?

I'm trying to create a symbolic link to overwrite an existent folder. I know I could simply delete the folder before create the link, however I'm looking for a ln option to do this. By now I'm ...
4
votes
1answer
760 views

Why permission denied upon symbolic link update to new target with permissions OK?

On a Linux machine (a computing cluster, actually), I copied a folder from another user (who granted me permissions to do so using the appropriate chmod). This folder contains symbolic links to files ...
0
votes
2answers
47 views

How can i create symbolic link for directory

I am trying to create symbolic link as below ln -s /home/scripts/logs /home/log The directory /home/log is already existing ,which cant be deleted. When i do this it creates the symbolic link as /...
1
vote
3answers
230 views

link config files

Problem I'm trying to move my config files from a .dotfiles folder, and link those files to the corresponding config path. Example In this example I'm trying $ ln -s ~/.dotfiles/nvim/init.vim ~/....
0
votes
1answer
41 views

Run node script with a global variable

I have a node script index.js with a node_modules folder. /script/myTestJscript/index.js /script/myTestJscript/node_modules /script/myTestJscript/package.json I could run the script with the command ...
1
vote
1answer
248 views

What does “ln -t” do [duplicate]

What does ln -T do? I know the flag does not exist in the BSD version of ln, and it only exists in the GNU version, and I have read the documentation that it will make ln "treat LINK_NAME as a normal ...
68
votes
14answers
4k views

Tips for remembering the order of parameters for ln?

I have used ln to write symbolic links for years but I still get the order of parameters the wrong away around. This usually has me writing: ln -s a b and then looking at the output to remind ...
3
votes
3answers
760 views

Recursively “find” file names containing string and symlink files in another directory

I am trying to symlink a set of specific files from a project I'm working on. There is a known string in each of the filenames I wish to symlink. Here is what I have so far: ln -s find ~/path/to/...
2
votes
1answer
681 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 ...
0
votes
1answer
106 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 ...
7
votes
3answers
22k views

How to create a folder symlink that has a different name?

I want to create a symlink ~/.pm2/logs -> /opt/myapp/log When I run ln -sFf /opt/myapp/log ~/.pm2/logs I get a symlink ~/.pm2/logs/log -> /opt/myapp/log which is not what I want. I'd ...
0
votes
1answer
194 views

I want to make symlinks of all files in a directory EXCEPT the existing symlinks in the directory

I have a bash script that creates symlinks from the directories in one users directory to another users directory. I want the script to exclude existing symlinks in the source directory when creating ...
0
votes
2answers
576 views

How to regularly update symbolic link (ln -sf) via crontab

Background The PNG image files I want to use is stored in directories according to date, for example: /NAS-mein/data/201812/ PNG stored within it like /NAS-mein/data/201812/foo/bar/20181231_1500....
0
votes
1answer
37 views

create symlinks by dropping version number

I have large number of shared libraries like this: libexpat.so.1.6.7 libqquicklayoutsplugin.so libstdc++.so.6.0.24 libexportlib.so.1.0.0 libqsvg.so ...
4
votes
1answer
2k views

rm to remove a dir, any symlinks, AND symlink destinations? [duplicate]

I have two directories: /all/origins/ & /all/links/. Everything in links/ points individually to something in origins/, but not everything in origins/ is linked in links/. (Squares, rectangles &...
1
vote
1answer
1k views

unlink delete files which are not links [duplicate]

I created a hard link $ ln hours.sh hours_link test it $ ls -l hours* -rw-r--r-- 2 me staff 653 Apr 12 2018 hours.sh -rw-r--r-- 2 me staff 653 Apr 12 2018 hours_link remove it with unlink $ ...
5
votes
2answers
1k views

ln: create symlink using another symlink

Let's suppose I have one file and one directory: $ ls -l total 4 drwxrwxr-x. 2 user user 4096 Oct 8 09:53 dir -rw-rw-r--. 1 user user 0 Oct 8 09:53 file I created a symlink to file called ...
1
vote
1answer
264 views

How to create a link (ln -s) with an absolute path?

So using ln -s to make a link will make either a relative link (link->../file) or an absolute link (link->/home/user/dir1/file). But sometimes I don't want to type the entire absolute path, but ...
0
votes
2answers
3k views

mkdir -p if final target is symlink

Say we have: node_modules/ suman/ and node_modules/suman is a symlink if we do: mkdir -p "$PWD/node_modules/suman" I assume mkdir -p will not overrwrite the symlink? what about if $PWD/...
0
votes
2answers
1k views

What is the meaning of 'ln -sT' in Linux?

To be more precise: I know what the -s options stands for - I use it daily. But I saw someone in a tutorial, who was moving the document root of his website from /var/www/html/project to ~/www/project ...
11
votes
3answers
11k views

Why I can't create a hard link from device file in other than /dev directory?

When I wanted to create a hard link in my /home directory in root mode, Linux showed the following error message: ln: failed to create hard link ‘my_sdb’ => ‘/dev/sda1’: Invalid cross-device link ...
2
votes
1answer
3k views

Use libgfrotran.so.3 and GFORTRAN_1.0 on fedora 27

I am trying to use fortran code called SAMMY-8 which has its binary ready for use. I was using without any issue while I had f25 installed. When upgrading to f27 I got the following error when trying ...
1
vote
1answer
300 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
343 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 ...
2
votes
1answer
255 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 ...
0
votes
2answers
50 views

How do I delete all non-link files from a folder in Linux?

I accidentally copied a bunch of junk into /usr/lib . How do I rm everything in there except folders and link files?
1
vote
1answer
1k views

Multiple symlinks by wildcard: “ln -s ../*/*.txt TXT/”

I'm trying to create multiple symbolic links using wildcard, here the example: $ ls -R .: TXT a b ./TXT: ./a: a.txt ./b: b.txt There is a "parent directoory" containing various subdirs: a, b, ...
1
vote
2answers
38 views

How can I stack wildcards to target specific files?

I want to target all files called fooxxxbarxxx. The common thing among all those files is that it contains foo and bar. I've tried to use *foo*bar* and *foo**bar* but it doesn't work. Specifically,...
3
votes
3answers
281 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 ...
0
votes
2answers
502 views

Shell script keeps making broken symbolic links

I'm trying to manage my dot files inside a sub directory of $HOME and write a shell script that sets up symbolic links inside $HOME. #!/bin/sh for i in .cvsignore .gitconfig .npmrc .tmux.conf ....
1
vote
2answers
2k views

Rm hardlink without removing file/directory itself

Say I create a hardlink with ln x y. Is there a way to remove the link at y without removing the file at x, after I create the link? It looks like I did a rm -rf on y and it deleted x as well, would ...
-1
votes
2answers
1k views

Making a link using ln -s [duplicate]

I'm trying to make a link using: ln -s /Backup files/ /link 1 Instead of making the link, I'm get the following output: ln: target '/link' is not a directory What am I doing wrong?
2
votes
2answers
289 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
1k 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 ...
0
votes
1answer
116 views

Problem to install latest version of shellcheck from tar.xz

I have been downloading the latest version of ShellCheck and tried to install it on my System taking the following steps: I downloded shellcheck-latest.linux.x86_64.tar.xz then I run as root: # ...
9
votes
2answers
3k views

Why can't I create a `hardlink` to a file from a “mount --bind” directory on the same filesystem?

Original Problem I have a file on one filesystem: /data/src/file and I want to hard link it to: /home/user/proj/src/file but /home is on one disk, and /data is on another so I get an error: $ cd /...
0
votes
1answer
680 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 ...
1
vote
2answers
140 views

Why Does `'ln -s /directory 'D:'` Work Like It Does?

So, as mentioned here, 'ln -s /directory 'D:' maps the windows D: location to a Linux style directory. However, as far as I know, this goes against the Linux naming system. Why does Linux allow the ...
1
vote
1answer
62 views

ln -s reports that a procedure failed, but creates symlinks nonetheless

I am in the parent directory and there are a number of files with .fastq, .fq, .fastq.gz and .fq.gz extensions in different subdirectories. I created a subdirectory named FASTQC and want to create ...
2
votes
1answer
162 views

Inconsistent behaviour creating symbolic links with relative and force flag

I have an issue with creating symbolic links with ln, with the relative and the force flag set. The scenario is as follows: $ tree . ├── folder1 │   └── file └── folder2 I create the link: $ ln -...
6
votes
2answers
4k views

Size of symlink

Symbolic links do take room, of course, but just the room it takes to store the name and target plus a few bytes for other metadata Do symbolic links actually make a difference in disk usage? My ...