symlink

Bash: how to get real path of a symlink?

∥☆過路亽.° 提交于 2020-01-02 00:53:15
问题 Is it possible, executing a file symlinked in /usr/local/bin folder, to get the absolute path of original script? Well, .. I know where original file is, and I know it because I am linkging it. But, ... I want this script working, even if I move original source code (and symlink). #!/bin/bash echo "my path is ..." 回答1: readlink is not a standard command, but it's common on Linux and BSD, including OS X, and it's the most straightforward answer to your question. BSD and GNU readlink

How to move a symlink to the trash?

我的梦境 提交于 2019-12-30 22:54:21
问题 I don't see any options for the FSPathMoveObjectToTrashSync() function for not following links. Here is what I have tried Create a link and a file [ 21:32:41 /tmp ] $ touch my_file [ 21:32:45 /tmp ] $ ln -s my_file my_link [ 21:32:52 /tmp ] $ la total 8 drwxrwxrwt 12 root wheel 408 17 Maj 21:32 . drwxr-xr-x@ 6 root wheel 204 9 Sep 2009 .. -rw-r--r-- 1 neoneye wheel 0 17 Maj 21:32 my_file lrwxr-xr-x 1 neoneye wheel 7 17 Maj 21:32 my_link -> my_file Move the link to the trash OSStatus status =

Reading a symbolic link in kernel-space

房东的猫 提交于 2019-12-30 17:37:28
问题 I'm writing a LKM and need to find out where a specific symlink is pointing to. Basically I need the functionality of the syscall readlinkat (or readlink ) but in kernel-space. Is there an easy way to do this? Using readlinkat directly is not working for me, I'm always getting EFAULT (I guess this is because my buffer is obviously in kernel memory space and not in user-space). 回答1: Firstly, you can't use user space system calls( readlinkat() or readlink() ) directly in your kernel module.

Ignore symbolic links in .gitignore

Deadly 提交于 2019-12-30 04:02:16
问题 Is it possible to tell Git to ignore symlinks ? I'm working with a mixed Linux / Windows environment and, as you know, symlinks are handled very differently between the two. 回答1: Use git version >= 1.6 Git used to treat sym-links the same as regular files, but newer git versions (>= 1.6) check if a file is beyond a symbolic link and will throw a fatal error. e.g.: # git init # mkdir newdir # touch newdir/foo # git add newdir/foo # git commit -m 'add foo' # mv newdir /tmp/ # ln -s /tmp/newdir

Correct way to setup Virtualbox 4.3 to use symlinks on guest (for meteor)

人盡茶涼 提交于 2019-12-30 00:56:27
问题 I use Windows 8 and installed Virtualbox so i can access to a Linux (Ubuntu) System. The most i still did to do this - so at this moment i have a working Virtualbox with Ubuntu 14.04 LTS. In my case i need this Virtualbox with Linux for meteor. The problem: meteor uses nodejs and so i need to have symlinks access (i think its symlinks - i read a few about it) Reference: How to run meteor app inside an Ubuntu VrtualBox and edit using an editor on a Windows host? He describes the same problem i

How do I find all of the symlinks in a directory tree?

你离开我真会死。 提交于 2019-12-29 10:08:08
问题 I'm trying to find all of the symlinks within a directory tree for my website. I know that I can use find to do this but I can't figure out how to recursively check the directories. I've tried this command: find /var/www/ -type l … and later I discovered that the contents in /var/www are symlinks, so I've changed the command to: find -L /var/www/ -type l it take a while to run, however I'm getting no matches. How do I get this to check subdirectories? 回答1: This will recursively traverse the

Is there a way to check if there are symbolic links pointing to a directory?

天涯浪子 提交于 2019-12-29 02:32:14
问题 I have a folder on my server to which I had a number of symbolic links pointing. I've since created a new folder and I want to change all those symbolic links to point to the new folder. I'd considered replacing the original folder with a symlink to the new folder, but it seems that if I continued with that practice it could get very messy very fast. What I've been doing is manually changing the symlinks to point to the new folder, but I may have missed a couple. Is there a way to check if

Detecting a symlink in Java [duplicate]

有些话、适合烂在心里 提交于 2019-12-28 06:18:15
问题 This question already has answers here : Java 1.6 - determine symbolic links (7 answers) Closed 5 months ago . Given a Java 'File' object, how can I detect whether or not it refers to a symlink? (If it helps/matters, I know the file refers to a directory, not to a file) 回答1: Also you can use isSymbolicLink(Path path) method. It will be more reliable. java.io.File file = ...; boolean isSymbolicLink = Files.isSymbolicLink(file.toPath()); Similar examples from Java Doc 'Detecting a Symbolic Link

Tar changes relative symlinks to absolute symlinks

梦想的初衷 提交于 2019-12-25 18:41:32
问题 To simplify the sysroot generation for cross compiling, I generate a tar file with relative symbolic links. If I print the tar context with tar tvf sysroot-libc6-dev.tar then I get the correct result: lrw-r--r-- jens/jens 1 2018-03-30 23:42 usr/lib/x86_64-linux-gnu/libBrokenLocale.so -> ../../../lib/x86_64-linux-gnu/libBrokenLocale.so.1 lrw-r--r-- jens/jens 1 2018-03-30 23:42 usr/lib/x86_64-linux-gnu/libanl.so -> ../../../lib/x86_64-linux-gnu/libanl.so.1 lrw-r--r-- jens/jens 1 2018-03-30 23

Tar changes relative symlinks to absolute symlinks

倾然丶 夕夏残阳落幕 提交于 2019-12-25 18:41:23
问题 To simplify the sysroot generation for cross compiling, I generate a tar file with relative symbolic links. If I print the tar context with tar tvf sysroot-libc6-dev.tar then I get the correct result: lrw-r--r-- jens/jens 1 2018-03-30 23:42 usr/lib/x86_64-linux-gnu/libBrokenLocale.so -> ../../../lib/x86_64-linux-gnu/libBrokenLocale.so.1 lrw-r--r-- jens/jens 1 2018-03-30 23:42 usr/lib/x86_64-linux-gnu/libanl.so -> ../../../lib/x86_64-linux-gnu/libanl.so.1 lrw-r--r-- jens/jens 1 2018-03-30 23