All Questions

Tagged with
Filter by
Sorted by
Tagged with
99
votes
1answer
160k views

How to change where a symlink points [duplicate]

Can you tell me what this is in the area marked red? If I want to change /media/files/tb-prod/files to some other path, how would I do that?
51
votes
5answers
63k views

Determining if a file is a hard link or symbolic link?

I'm creating a shell script that would take a filename/path to a file and determine if the file is a symbolic link or a hard link. The only thing is, I don't know how to see if they are a hard link. ...
36
votes
8answers
6k views

What is the difference between a hard link and a file?

A hard link is defined as a pointer to an inode. A soft link, also known as a symbolic link, is defined as an independent file pointing to another link without the restrictions of hard links. What is ...
31
votes
6answers
7k views

Replace file with hard link to /dev/null

I'm running an application that writes to log.txt. The app was updated to a new version, making the supported plugins no longer compatible. It forces an enormous amount of errors into log.txt and does ...
31
votes
2answers
13k views

Resolving symbolic links (pwd)

Say I do the following: cd /some/path ln -s /target/path symbolic_name If then do: cd /some/path cd symbolic_name pwd I get: /some/path/symblic_name and not: /target/path Is there a way to ...
21
votes
6answers
12k views

Getting relative links between two paths

Say I have two paths: <source_path> and <target_path>. I would like my shell (zsh) to automatically find out if there is a way to represent <target_path> from <source_path> as ...
17
votes
1answer
2k views

ls -l vs ls -lL

I know this looks like a duplicate, but previously asked questions do not answer my question so in the shell I go to /home directory and create a directory there calling it play then I go to this ...
15
votes
2answers
6k views

How to replace a symbolic link with a copy of a file it links to?

Having a (single, no batch filesystem processing needed) symlink, what a command line to use to replace it with a copy of the file it links to?
11
votes
2answers
11k views

Why do hard links seem to take the same space as the originals?

Thanks to some good Q&A around here and this page, I now understand links. I see hard links refer the same inode by a different name, and copies are different "nodes, with different names. Plus ...
10
votes
2answers
19k views

tar command - skip symlinks

I use the tar command as, tar -cvf protTests.tar protTests/* to tar all files inside the folder, protTests. But this is including the symbolic links inside the folder, which is not a desired one. ...
9
votes
2answers
992 views

How can I list files of which no symlinks exist?

I have a large "myfiles"directory full of miscellanous documents and do not want to modify its structure. I therefore created (several) other directories for each class of documents. For example I ...
7
votes
2answers
515 views

How to use ls to group directory symlinks with other directories?

ls --group-directories-first displays all directories before files, but if there is a symlink to a directory, it is displayed among the files. Is there a way to group directory-symlinks with other ...
6
votes
2answers
527 views

How to unlink file symlinked to itself without destroying

I'm not sure how this happened, but I have a number of files that have becomed symlinked to themselves. It seems likely that there won't be any way to restore the files, but hopefully there is. Here ...
6
votes
1answer
3k views

How to replace a symbolic link with an equivalent hard link?

Having a (single, no batch filesystem processing needed) symlink, what a command line to use to turn it into a hard link to the same file?
6
votes
2answers
1k views

Find incoming symlinks [duplicate]

In Linux, what is the best way to find all symbolic links that point to a given file (regardless of whether the symlink is relative or absolute)? I realize this will require scanning the whole ...
6
votes
1answer
3k views

What exactly files whose names' prefix is “AT.postflight.” are needed for?

I am not sure if this question should be asked here, since I am on an OS X, but since I am using bash, and I am asking about the meaning and the purposes of some files. I am trying to understand why ...
5
votes
1answer
1k views

Where is information about hard/soft links stored?

Where does the *nix system store information about number of hard links to a specific inode? I can't find any information about that. Everywhere what a hard link is but rarely a bit more advanced ...
5
votes
1answer
2k views

Cannot delete broken symbolic link

I have a symbolic link formerly pointing to a Dropbox directory. I don't know what I did wrong, but apparently now it points to itself. hyper@mypi:/home/hyper/test$ ls -l total 1024 lrwxrwxrwx 1 ...
5
votes
1answer
210 views

Can non-canonicalized forms of filesystem paths be significant? (eg. “foo//bar”, “foo/./bar”, and “foo/../bar”)

I have a script for building a particular flavor of GCC cross-compiler. Throughout the script there are many paths that are not in canonical form, such as duplicate path separators (/xxx/foo//bar/yyy) ...
4
votes
1answer
6k views

accessing path from outside the root with symlink

I need to add an outside path to my apache configuration. (httpd) so, I made a symlink to this path in my httpd root folder, the path is: /var/log/httpd/ (I want to display logs directly in my ...
4
votes
1answer
678 views

Can I create a symlink that will ignore subdirectories?

I'm trying to get dropbox symlinked to the relevant folders in /home. I'd like to symlink them like this: ~/Dropbox/Pictures --> ~/Pictures ~/Dropbox/Camera Uploads --> ~/Pictures/Camera ...
4
votes
1answer
56 views

Can we create soft links that concatenate multiple files? [duplicate]

Let's say that I have files f1, ..., f9. I want to create a single view -- or a soft link -- say f, that displays a concatenated view over the 9 files. For example, if I execute wc -l f the answer ...
4
votes
0answers
169 views

Move a file and re-target all of its symlinks [duplicate]

Possible Duplicate: How can I “relink” a lot of broken symlinks? Is there any way to move a file to a new location, and then re-target its symlinks to the new location, using a shell script? I'd ...
4
votes
1answer
3k views

read only symlink or something similar? [duplicate]

I created myself a NAT for home use (Ubuntu+Samba+Greyhole+Apache+MySQL+other web server related stuff). 90% of files I store there are pictures that i really don't want to lose (that's why Greyhole). ...
3
votes
2answers
2k views

Create a new link to access all files and folders

I get stuck to create a shell script for a new link something like that link linkPathName orginalPathName I want to create a link between a new link and original path; however, both can access ...
3
votes
1answer
145 views

Some special files in Unix

Background There are lots types of special files in Unix, for example symlinks, device files and proc files (under /proc). /proc files are just normal files or even text files. But for the rest, I ...
3
votes
2answers
3k views

Convert a hardlink into a symbolic link

It is easy to convert a symlink into a hardlink with ln -f (example) It would also be easy to convert a hardlink (filenames link and original) back to a symbolic link to link->original in the case ...
3
votes
2answers
482 views

open a file using CDPATH and symlink

To quickly move around, I added a path to CDPATH that contains symlinks to different locations. I did this by adding the following line to .bashrc: export CDPATH=~/symlinks When working with ...
3
votes
2answers
158 views

List direct symbolic links (links that don't point to another symlink)

I need to make a list of all direct symbolic links in a directory, i.e. symbolic links that point to another file which is not a symbolic link. I tried to do it this way: for i in $(ls -1A); do ...
3
votes
1answer
127 views

Symbolic link starting with .#

I have a symlink in one of my directories that has the following name: lrwxrwxrwx 1 XXXX ZZZ 37 Jan 15 18:18 .#perl.org -> XXX@YYY.com.2980:1344441539 I am wondering what this symlink ...
2
votes
3answers
520 views

What has happened to the file when I entered “mv file.txt ../”?

I wanted to move 'file.txt' one folder up, but instead of mv file.txt ../file.txt I entered mv file.txt ../. Now the file is gone and I didn't get any error message. So it seems the some action was ...
2
votes
3answers
217 views

Switch symlink and directory

I have a directory and a symlink to it: mkdir dir ln -s dir dir_symlink I want to replace the symlink with the directory and the directory with the symlink. Is there a way to do that atomically (or ...
2
votes
1answer
206 views

Why symbolic links have no data blocks allocated to them in ext4fs?

I am a Unix wanderer. I just noticed that symlinks don't have data blocks allocated to them, I think the inode of the symlink file stores the filename which the symlink refers to, is this actually the ...
2
votes
1answer
2k views

Creating a copy of a file, that gets automatically updated

I'm using Fedora 26. I want a script to run at startup, but also have this script in my scripts folder. How can I make it so the /etc/init.d/foo gets updated when I edit ~/scripts/bar? I was thinking ...
2
votes
3answers
1k views

How to determine if a soft link's target is a directory or a file?

Given the ll command outputs as follows #> ll lrwxrwxrwx ... How to determine if a soft link's target is a directory or a file from "lrwxrwxrwx"?
2
votes
2answers
129 views

Something like a symbolically linked file, but with change details attached?

Is there a file type or method for using files in which certain files look and behave like symbolically linked files, but contain extra meta information for changing the data when they are read? ...
2
votes
1answer
67 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-----...
2
votes
2answers
5k views

How do I dereference links when extracting from a tar file?

If I have a tar file, bob.tar, which contains real_file and link_to_real_file, in which the latter is a symlink, is there a way to extract the contents of bob.tar so that link_to_real_file will not be ...
2
votes
1answer
812 views

How to zip directory excluding symbolic links and the files they point to?

I have a directory with files, subdirectories and symlinks How to zip only files and folders from that directory without symlinks or files referred to by the symlink?
2
votes
1answer
2k views

Creating symlinks in the etc directory without root access

What I would like to create if I had root access would be a symlink from some file or folder in the /etc to another file or folder in the /etc. However, I do not have root access. Is there any way to ...
2
votes
0answers
48 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 ...
2
votes
0answers
74 views

AIX : NOFOLLOW_LINKS is not supported on this platform

I have an AIX 7.2 machine. I am trying to run a Java program on it. It gives me this error: NOFOLLOW_LINKS is not supported on this platform. It is because I am using this call in the program: Files....
2
votes
0answers
56 views

Given a pathname and a symlink to a directory in the pathname, is there a command which can return an equivalent pathname making use of the symlink?

Sometimes I have a long pathname, and want to shorten it by some precreated symlink to a directory in the pathname. Specifically, given a pathname /path/to/file, and a symbolic link /symlink to a ...
2
votes
0answers
217 views

How can I make Krusader show real size of symlinked files?

In the "size" column in Krusader, there is a link's size noted, instead of the size of the actual file. This is the same as what ls -l shows (the full address of the target file, e.g. 64 B instead of ...
1
vote
1answer
295 views

Creating an symbolic link in /bin automatically creates a second link in /usr/bin and the which command chooses /usr/bin

I just created an executable: ln -s /path/to/script.sh /bin/script then I check if everything succeeds and it does(/bin/script is created) but this has also created: /usr/bin/script and if I check ...
1
vote
2answers
7k views

ls shows a directory but it is inaccessible

I was trying to copy one folder from one location to another. The folder is about 6.4 Gb. So I did cp -r source_folder level1/val after that, I went into the level1 folder and checked: level1$ ...
1
vote
2answers
2k views

readlink -f not working on multiple files

I tried to run readlink -f on multiple files by using wildcard "*", but it evaluates other files as operand Command readlink -f *log Output (desired) /home/trail_1.log /home/trail_2.log Am I ...
1
vote
1answer
144 views

How to create a POSIX-compliant relative symbolic link in /bin/sh?

The idea is to have the environment configured like this: mkdir ~/shortcuts cd shortcuts ln -s ../.. up2 As a result I want to be able to go 2 directories up the file tree whenever I call: ~/dev/...
1
vote
2answers
46 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:[...
1
vote
1answer
326 views

Is it possible to download from link file from a web directory?

Suppose there is an instance of apache whose web directory is: /var/www/html Is it possible to create a link from a file in a distinct directory so that a web user can download that file using the ...