Questions tagged [ln]

Use this tag for questions related to the `ln` (link) command. The `ln` command is available in *nix OS to create links, allowing more than one filename to refer to the same file. Two types of links can be created using `ln`: symbolic links and hard links. Do not use this tag to refer to the natural base-e logarithm (furthermore base-e log is written "log" in most programming languages): use the [natural-logarithm] for that.

The ln (link) command is used in *nix OS to create links, allowing more than one filename to refer to the same file. Two types of links can be created using ln:

  1. Symbolic links: refer to a symbolic path indicating the abstract location of another file. The two file names need not be on the same file system. System call: symlink().
  2. Hard links: refer to the specific location of a physical file. The two file names must both be on the same file system. System call: link().

Note: For questions related to ln function which is used to calculate logarithms, please use the tag.

162 questions
3
votes
3 answers

Recursively symlink directory tree

I'm trying to run a recursive symlink from one directory into another: find data/* -type d -exec ln -s {} current/{} \; With one addition: I need to strip off data/ from the prefix. Running on OS X server (10.8, Mountain Lion)--not all standard GNU…
guice
  • 976
  • 4
  • 11
  • 31
3
votes
1 answer

Failed to create symbolic link on WSL

I want to create symbolic link using a script shared by my team. The script works fine on Mac, but this line: ln -s `pwd`/git-hooks/post-checkout .git/hooks failed on my Windows machine, WSL complains that: ln: failed to create symbolic link…
Elderry
  • 1,902
  • 5
  • 31
  • 45
3
votes
0 answers

Version control (`git`) for a file outside of the controlled directory - linking won't do

I have a git repository that depends on an external (to the repo) file which is frequently and irregularly regenerated. It will always have the same name, but not always the same inode. I can't use a symlink since git won't follow it and I won't get…
Sean D
  • 381
  • 3
  • 14
3
votes
1 answer

Symbolic link in makefile

Consider the following makefile: SHELL = /bin/sh MY_DIR := $(realpath ./) BASE_DIR := $(realpath ../..) BASE_SRC_DIR = $(BASE_DIR)/src BASE_INC_DIR = $(BASE_DIR)/include HUL_DIR = $(MY_DIR)/hul JNI_DIR = $(HUL_DIR)/jni JNI_SRC_DIR =…
André Fratelli
  • 5,920
  • 7
  • 46
  • 87
3
votes
2 answers

Get real windows directory of mounted directory in MSYS (or use ln with MSYS)

I have an MSYS installation, and I am writing a bash script to set up some files. I would like to make a directory symbolic link from the bash script in MSYS, but to do that I will need to use mklink /D, which is a windows command. ln does not work…
9a3eedi
  • 696
  • 2
  • 7
  • 18
3
votes
3 answers

/usr/share/zoneinfo epic fail

I have just, in my groggy morning state, reversed & confused the arguments to ln, replacing /usr/share/zoneinfo/America/Toronto with a link to the non-existant /etc/localtime, when I really wanted to link /etc/localtime to Toronto. Now I have no…
nullpointer
  • 191
  • 1
  • 7
3
votes
2 answers

Bash Shell Script to search for files using mdfind

I have a folder of about 350 images (they are scanned recipes). To make finding them easier, I have written a search program in bash shell script. I have bash version 3.2 on Mac OS X 10.8 Mountain Lion. The basic idea of my program: Ask the user…
baum
  • 959
  • 13
  • 27
2
votes
1 answer

Using find on subdirectories and create symlinks to all files

Ok, so I've been trying to get my head around this, but I'm struggling. The premise is this: I have a directory with lots of subdirectories (some of which also contain more subdirectories), and I've got another separate directory on a different…
analbeard
  • 45
  • 3
  • 13
2
votes
1 answer

make links between ext4 and fat32

it is used in android phone. Because my ROM is big enough(around 8G), and my SDCard has been full with various files, so i want to link a big file stored in ROM to SDCard so as to save the treasure space of SDCard( the big file cannot be identified…
Searene
  • 25,920
  • 39
  • 129
  • 186
2
votes
2 answers

Ln command error "target not a directory"

I have the following code inside a spec file: mkdir -p %{buildroot}%{_qt6_bindir} pushd %{buildroot}%{_qt6_bindir} for i in * ; do case "${i}" in qdbuscpp2xml|qdbusxml2cpp|qtpaths) ln -v ${i} %{buildroot}%{_bindir}/${i}-qt6 ;; …
2
votes
0 answers

Create a dynamic link to a changing folder in time

On my web-browser application I have a list of folder by when pictures are getting taken via security camera. Folder structure is something like: ~/security_camera/test_11_11_2011/.jpg ~/security_camera/test_12_12_2012/.jpg ... ... ...…
Marco smdm
  • 1,020
  • 1
  • 15
  • 25
2
votes
1 answer

Creating symbolic link in a Databricks FileStore's folder

I would like to create a symbolic link like in linux env with the command : ln -s. Unfortunately I can't find anything similar to do in a Databricks FileStore. And it seems that ln operation is not a member of dbutils. Is there a way to do this…
ilmar
  • 95
  • 1
  • 7
2
votes
1 answer

Dockerfile symbolic link with wildcard (*) not working

I'm new to docker and I'm having problem creating a symbolic link with the following RUN command: FROM php:7.3-apache RUN ["/bin/bash", "-c", "ln -s /app/frontend/web/* /var/www/html"] && \ ln -s /app/backend/web /var/www/html/admin Here is…
aleccentric
  • 101
  • 8
2
votes
1 answer

How to create a symlink of a directory inside another symlinked directory?

I succesfully deployed a Laravel website onto a web server by cloning it into a directory at the same level as public_html (called laravel) and creating a symlink to the laravel/public directory into public_html, with this command: ln -s…
jokogarcia
  • 163
  • 2
  • 11
2
votes
1 answer

Symbolic Link broken after creation

The links get broken right after I create them. I use ln correctly. ln -s SOURCE TARGET Create symbolic link $ sudo ln -s ./sites-available/examble.domain.com ./sites-enabled Compile NGINX - fails due to broken symbolic links Note: The problem is…
Eksapsy
  • 1,541
  • 3
  • 18
  • 26
1 2
3
10 11