Tag Info

New answers tagged

0

Thanks for the discussions so far. Following is an explanation from a colleague of mine who is not a member of the Super User community: /tmp/strange_dir in my case is an NBD/VFS (Network Block Device/Virtual File System) directory. This type of virtual file system differs from more traditional file systems and has its own implementation of the shell ...


3

This can happen if you are accessing the directory via a symlink, but the linked directory is removed. For example, in /tmp, let's create a directory and a symlink to that directory: $ cd /tmp $ mkdir normal_dir $ ln -s normal_dir strange_dir Now, if we navigate to strange_dir, we get the expected output: $ cd strange_dir $ ls -a . .. If, however, we ...


1

It's conceivable that such an aberration could be created if somebody said mkdir /tmp/strange_dir at a time when the filesystem was full (i.e., there were no free blocks).  It would still (probably) have been possible to create the strange_dir directory entry in /tmp, because that would require only a few bytes of unused space in one of the blocks already ...


1

ls, sort and your script all give the same ordering, which is lexicographic based on ASCII value of each position except that non-alphnumeric are ignored abc. abc.. abc0 abc1 abc_1 abc.1 abc..1 abc.1.4 abc.1..4 abc.1.5 abc2 abc~2 abc_2 abc-2 abc.2 abc#2 abc%2 abc3 abc4 abc4.1 abc4.2 abc49 abc_9 abca abcA ...


0

Simple answer: find -type f -print0 | xargs -0 ls -al


0

--tree -ifpugDs $PWD-- etc. Very close. The problem is $PWD, which results in useless garbage if you have actual file names, not Unix-style file names, that is, with no spaces. To get it to work on any file system, EG NTFS, you need to quote the $PWD. I use the C-shell, as I was a berkeley/Sun user at the Lab, but the same ideas apply in bash. tree -if ...


2

When you do for f in data/* the enumeration of filenames is being done by your shell not "ls". Normally, shells will sort lexicographically, (bash does) but they may use your LC_COLLATE locale collating sequence order. Perhaps your particular shell does not sort at all. Directory entries are usually not sorted, but it depends on the underlying filesystem. ...


2

well, that didn't take long, I should have suspected from the beginning. zsh runs the GNU ls, whereas bash runs the default mac osx ls. hence the difference in behaviour. I don't know why or how zsh chooses gnu ls and how put the gnu ls there to begin with, but ATM I don't care. aliased 'ls' to 'ls --color' in zsh and I have my colorful ls again. yay! ...



Top 50 recent answers are included