Tag Info

New answers tagged

3

Not the issue of ls. It's how symlinks work. The .. gets you into the parent of the current directory, the directory doesn't know you got to it through a symlink. The shell has to intervene to prevent this behaviour. For the shell builtin cd, there is special handling that doesn't just call chdir but memorizes the full directory path and tries to figure out ...


0

Since you tagged your question with zsh I assume we are talking about this shell. Most probably you have set (either directly or indirectly with some external script like oh-my-zsh) the variables CHASE_LINKS and/or CHASE_DOTS. To confirm that run setopt | grep -i chase and see if they are listed. If they are, just unset them: unsetopt CHASE_DOTS unsetopt ...


0

From the output, the links are all to ~/third-party-source/openssl/crypto. So either navigate there from the GUI, or with the command line cp, use --dereference: -L, --dereference always follow symbolic links in SOURCE Like so: cp -L ~/third-party-source/openssl/include/openssl/* /some/where/else


1

bash "knows" about symlinks and tracks this info when you use a symlink to enter a directory. You can check this by doing the following in your example: $ cd /dir2 $ cd linked $ pwd /dir2/linked $ PWD='' bash -c pwd /dir1 You need to start the bash with an empty PWD variable, otherwise it uses that trick to display the "fake" path. Note that ls is a ...


1

The output of ll, which I assume is a shell alias for ls -l, does not contain this information in the mode/permissions of the symlink. On Linux (symlink(2)): The permissions of a symbolic link are irrelevant; the ownership is ignored when following the link, but is checked when removal or renam- ing of the link is requested and the link is ...


2

You can use the -F parameter to ls to get: -F, --classify append indicator (one of */=>@|) to entries i.e.: # ln -s videos Videos # ls -l lrwxrwxrwx. 1 guido guido 6 Jan 23 14:11 videos -> Videos # ls -lF lrwxrwxrwx. 1 guido guido 6 Jan 23 14:11 videos -> Videos/ Anyway, I'd suggest you create symlinks to directories like ...


0

I think what you want is: ls -l filename man is your friend: man ls


3

It's hard links to directories that can break the filesystem structure. Hard links to other types of files aren't a problem. For example: mkdir foo ln foo foo/self rmdir foo rmdir foo doesn't actually remove the directory since it has a remaining link — the self entry inside foo itself. foo has become detached from the filesystem; it can't be reached ...


0

The above is confusing. Are you talking an SMB share shared from a linux server or a windows server? I was just checking this out (I have my 'C'-drive) mounted on my linux client. Of course on windows, in the root, all the symlinks work. However on my linux client I see s# ll /athenae ls: cannot read symbolic link /athenae/bin: Operation not ...


2

You can also use gnu stow, a symlink farm manager. Assume the following layout: . ├── drive │   ├── a │   │   ├── b │   │   │   └── bar │   │   └── c │   │   └── baz │   └── b └── music └── a └── b └── foo Execute: $ stow --target music --dir drive . Result: . ├── drive │   ├── a │   │   ├── b │   │   │   └── bar │   │   └── ...


-1

Your questions seems rather confusing. Essentially what you are asking is why *nix works the way it does in regards to sym/hard links. You have already established that a symlink has its own inode and data structures, compared to a hardlink which uses the same inode of the existing 'file'. Your question now asks why these symlinks can't point directly to ...


4

SLINK has its own inode, and this inode will point to the inode of A.DAT. No, it doesn't reference the inode at all. It points to the name of A.DAT. If the name is changed, the reference breaks. This is why symlinks can work across filesystems. The inode (or whatever data structure is used) may not be visible, but the name is.


4

Since your primary aim is to have a combined view of your local and external Music folder, I think a union mount via overlayfs could be used, especially if the files are not being written to. The basic command is, in older kernel versions (<3.18): mount -t overlayfs -o lowerdir=/read/only/directory,upperdir=/writeable/directory overlayfs /mount/point ...


0

Since version 3.3, GNU diff supports not dereferencing symlinks, but then compares the paths they point to. Install GNU diffutils >= 3.3 and use the '--no-dereference' option; there is no short option for that. Diagnostic will be silent if the paths are equal, or: Symbolic links /tmp/noderef/a/symlink and /tmp/noderef/b/symlink differ if the paths ...


1

You can also use realpath: % realpath * /data/code/mdweb/Gemfile /data/code/mdweb/Gemfile.lock /data/code/mdweb/README.markdown realpath is not POSIX. It is available by default on FreeBSD systems, and on some (but not all) Linux systems (but AFAIK can be installed as a package on most, if not all, Linux systems). realpath's behaviour might be different ...


3

readlink only works with one file, you need a loop to do that: for f in *; do readlink -f -- "$f" done


0

In linux, any physical storage can be assigned to any path in the filesystem any number of times. file paths are just inodes (handles/pointers) to the physical storage. You can map the same physical file/folder to different filesystem paths in at least 3 ways: 1) mounting. Just as you can mount an entire physical drive to a directory, you can also mount an ...


0

If I understand things correctly you have ( a bit abstracted ): /data/html/xyz.html you have a link in your home directory: /home/user/html -> /data/html so the data is actually stored on the separate partition /data Now you could use the xyz.html file from /var/www/html by linking: /var/www/html -> /data/html The commands for that are: cd ...


0

yes it is possible to symlink one folder to several places. As far as I understand your question, you want two symlinks: /home/user/www -> /mnt/partition/www /var/www/html -> /mnt/partition/www I'm happy to adjust my answer should this be different. However, the general procedure should be the same. ln -s /mnt/partition/www /home/user/www ln -s ...


1

. is a regular expression metacharacter in sed, which matches any single character. Because you just insert the $from path into the regular expression directly, the . is there as though you'd written: sed "s@.@../pool/@" yourself. That replaces any single character, once, with "../pool/", so it has the effect of deleting the first character and inserting ...


2

But something about the syntax is perplexing and counter to what I would expect. The arguments for ln, in the form that you're using it, are: ln [OPTION]... [-T] TARGET LINK_NAME (1st form) The perplexing, unintuitive thing is that when you're creating a symlink, the target argument for ln isn't expected to be a path to a file, but rather the ...


2

You can create the link in a subshell, as follows: (cd deploy && ln -s resources.build.php resources.php && cat resources.php) When the subshell ends execution, you will find yourself still in the correct directory. Alternatively, you may try ln -s resources.build.php deploy/resources.php which also works, neglecting to include in ...


2

The first line looks wrong. That should probably be nameofuser=`logname` What you posted doesn't assign anything to nameofuser, and then you try to use it and it evaluates to an empty string.


0

Yes, they share a common sense of the word "link", in the abstract sense of "using a (text) key to look up a named resource". It's helpful to start by looking at the "regular" kind of file link, the hard link. A hard link is an entry in a Unix directory that associates a name with a particular file on the disk by pointing to its inode. When the file is ...


4

Not at all. One involves redirecting all references to a file name ( any kind of file ) to a different file instead ( symlinks ), and the other involves building an executable image by copying code from a library into the executable ( static linking ) or referencing a dynamic library that contains the required code and loading that dynamic library at ...


1

I would like to recommend the z utility - https://github.com/rupa/z (which is inspired by another utility named j). What z does is override your shell's cd function to add a side-effect of logging all the directories you visit. These directories are stored in the file ~/.z in a descending order of "frecency", such that a directory would appear higher if it ...


0

There is $CDPATH: mkdir -p ./1/2/3/4/dir ./3/2/1/dir ./12/dir CDPATH=":$HOME/1/2/3/4:$HOME/3/2/1:$HOME/12:" cd dir If you put a list of frequently visited hub paths in its value, you can then cd to any of their child paths without specifying the full path. cd will put you in the first match it finds. And it will print your location to stdout when it does: ...


4

You could just set up some alias', like: $ alias abc="cd /home/user/Desktop/Folder" To store these for the longer term add them to your .bashrc file. This will work if it's just navigation you're looking for - however the 'abc' above won't be any use if you want to script anything. I personally think it might be as easy in the long run to learn and ...


8

Becoming familiar with your file system layout is all part of becoming a competent user - any time you spend with that aim in mind is not time wasted. However, with that said, you can indeed make it easier to move around the file system. Note that in Linux/UNIX, the file system is presented as a single tree, no matter how many devices make up your storage, ...



Top 50 recent answers are included