Tag Info

New answers tagged

0

The issue is SAMBA server has build in special support for unix (cifs) clients. When you use mount -t cifs on your linux host all symlinks are passed to you (cifs client) as is. ls /mnt/share/latest/dir/ -l /mnt/share/latest/dir/ -> /opt/share/data/201407 You may dislike this functionality but this is a design decision that has its pros, e.a. is not a ...


0

Hardlink creation on directories would be unrevertable. Suppose we have : /dir1 ├──this.txt ├──directory │ └──subfiles └──etc I hardlink it to /dir2. So /dir2 now also contains all these files and directories What if I change my mind? I can't just rmdir /dir2 (because it is non empty) And if I recursively deletes in /dir2... it will be deleted from ...


4

Shells keep track of symbolic links in the path to the current directory (this is known as logical current directory tracking). If you want to expand all symbolic links, pass the option -P to the cd builtin (for physical current directory tracking): cd -P logic If you're in a directory which you've accessed via a symbolic link and want to switch the ...


3

You can use readlink to determine where your link points, and provide this output as the target of your cd. cd "$(readlink <link>)" In the case of additional symlinks pointing to symlinks, readlink will simply provide the target, unless you specify one of it's options to follow symlinks to a canonical file target, for example readlink -f ...


14

With POSIX shell, you can use -P option of cd builtin: cd -P <link> With bash, from man bash: The -P option says to use the physical directory structure instead of following symbolic links (see also the -P option to the set builtin command)


3

As you have said, directory hard links are not possible. Perhaps you could move the original directory to a different location, such as a hidden folder, and make both of your directories soft links to the real location. That way you could rename them freely, and the links would still be valid. This shell alias may help: function mkdirlink { ...


0

It is possible for a process to interrogate the file system to determine its current working directory, using a method that’s a little too complicated to be on topic as an answer to this question.  This is what the pwd program and the getcwd library function do.  In the early days of Unix, they were the only ways to find out what your working directory was.  ...


2

Windows has a special syntax \\MACHINE\DIRECTORY…\FILE meaning the file located at \DIRECTORY…\FILE on the machine called \\MACHINE over the SMB protocol. This is built into the operating system and specialized to one network protocol. Linux has a flexible filesystem based on the notion of mounting. Filesystems are attached to an existing directory, and the ...


2

You can't: A symlink is simply an extra inode (a structure that points to the file) and this inode consists of, amongst other things, a deviceId and an inode pointer. The deviceId effectively points to a device special file within the /dev directory and the inode pointer points to a block on that device. Your network location of 10.0.1.103 does not and ...


12

In most shells including bash, pwd is a shell builtin: $ type -a pwd pwd is a shell builtin pwd is /bin/pwd If you use /bin/pwd, you must use the -L option to get the same result as builtin pwd: $ ln -s . test $ cd test && pwd /home/cuonglm/test $ /bin/pwd /home/cuonglm $ /bin/pwd -L /home/cuonglm/test By default, /bin/pwd ignores symlinks and ...


0

This is due to osx's lack of support for NTFS. I just transferred everything all over again through ssh, and it worked perfectly.


0

You cannot change the permissions of a symbolic link. You could use acl(5) to change that. As an expmple you can use setfacl --set u::rwx,g::r-x,o::r-x /path/to/filename to change the ACL although that won't change the permissions of the file.


1

You can use $LS_COLORS to do this. If your version of ls supports specifying the colors using that variable, you can define output per file type. It's builtin behavior and very configurable. So I created some files to demo this like: for f in 9 8 7 6 5 4 3 2 1 do touch "${f}file" && ln -s ./"${f}file" ./"${f}filelink" done So now I'll do: ...


3

In zsh, this would be easy thanks to glob qualifiers: grep PATTERN **/*(.) The pattern **/ traverses subdirectories recursively. The glob qualifier . restricts matching to regular files. Without zsh, use find (see Michael Horner's answer). And in this particular case, GNU grep can do what you want (it's exactly what grep -r does) — but only since version ...


-2

Try this one: ls | grep -v " -> "


7

For the stated question you can use find: find . -mindepth 1 ! -type l will list all files and directories in the current directory or any subdirectories that are not symlinks. mindepth 1 is just to skip the . current-directory entry. The meat of it is the combination of -type l, which means "is a symbolic link", and !, which means negate the following ...


-2

Try this command: ls -p | grep -v @


6

From version 2.12 onwards, the -r option for GNU grep doesn’t dereference symbolic links unless you specify them by hand: -r, --recursive Read all files under each directory, recursively, following symbolic links only if they are on the command line. This is equivalent to the -d recurse option. -R, --dereference-recursive ...


5

Edit in response to updated question Since you only care about links, directories and regular files, and don't need to deal with the other filetypes that ls can identify (FIFOs, sockets etc), you could do something like stat. For the examples below, I have created the following test environment: $ ls -l total 4.0K -rw-r--r-- 1 terdon terdon 0 Jun 30 ...



Top 50 recent answers are included