Tag Info

Hot answers tagged

657

ls -t or (for reverse, most recent at bottom): ls -tr The ls man page describes this in more details, and lists other options.


376

Turns out this feature is not Apple-specific. This is a feature of BSD systems in general. /* Root is -A automatically. */ if (!getuid()) f_listdot = 1; Initially I was able to trace it back to the sources of 4.4BSD-Lite. It was already present in this FreeBSD commit from 1994 which is importing those sources. The feature is also present in OpenBSD ...


96

I do so love *nix and love seeing the inventiveness that goes into some of these replies... Mine's not nearly as fancy on GNU Linux : alias ls='ls --color -h --group-directories-first'


54

You can use: ls -d -- */ Since all directories end in /, this lists only the directories in the current path. The -d option ensures that only the directory names are printed, not their contents.


52

What is it? It's name is actually Icon\r, with \r being the carriage return 0x0D. If letting the shell autocomplete the path in Terminal, it yields Icon^M, ^M being \r. Icon^M is a file existing in all directories that have a custom icon in Finder. If you change a directory's icon e.g. in its Get Info dialog by pasting an image into the icon in the upper ...


49

Does your version of ls support the --time-style option? If so: ls -la --time-style=full-iso blah -rw-r--r-- 1 root root 0 2011-11-08 18:02:08.954092000 -0700 blah


42

ls is actually separate from Bash. Mac OS X has a BSD version of ls, which requires -G on the command line, or CLICOLOR (and perhaps LSCOLORS) in the environment. See man ls for more info.


39

It means that the file is executable. A classifier is shown when -F is passed to ls via the command line or otherwise.


37

Is ataka here the owner of directory? Well, yes (third column), but it also happens to be the name of the directory (last column). +-permissions that apply to the owner | | +-permissions that apply to all other users | | | | +-number of hard links | | | | | | +-size ...


35

It indicates that the file has extended attributes. Use ls -l@ to see them. You can use xattr to edit these attributes. xattr -h will give you the inline help for it.


34

Your expectations are based upon DOS Think/Windows Think and are wrong. On MS-DOS, Windows, and indeed a few other IBM/Microsoft operating systems, wildcard expansion is done by the command itself, and things like the /a option to the dir command act as attribute filters during wildcard expansion. dir expands wildcards like *, which the command interpreter ...


22

Stephen Martin's response gave a warning, and listed the current folder as well, so I'd suggest find . -mindepth 1 -maxdepth 1 -type d (This is on Linux; I could not find -maxdepth and -mindepth in the POSIX man page for find)


21

Off the top of my head, I think is has something to do with the file having extended attributes available. Here's a link to a similar discussion: http://discussions.apple.com/thread.jspa?messageID=5791060 So if you see a file with an "@" when you do an ls, try doing this: xattr -l <filename> That should show you the extended attributes. You can ...


20

Or does it know when its output is being piped to another command, and format its output differently in this case? Yes. From the full manual (available through info ls if the documentation is installed): If standard output is a terminal, the output is in columns (sorted vertically) and control characters are output as question marks; otherwise, ...


20

Try adding export LC_COLLATE="C" in your dotfiles, or changing the LC_ALL assignment to: export LC_ALL="C" This controls the way sorting on character level works — while the default would be to sort dotfiles inline, this will make sort list dotfiles first. To go further, quoting the GNU Coreutils manual (emphasis mine): If you use a non-POSIX ...


19

Simple - you pipe the output through head: ls -Bgclt /somwhere/in/the/past | head -n 3 You use -n 3 instead of -n 2 because of the 'total' line at the top of the ls output.


18

You were close. In bash you want process substitution, not command substitution: diff <(ls -1a ./dir1) <(ls -1a ./dir2)


18

From the ls(1) man page on Mac OS 10.6.1: If the file or directory has extended attributes, the permissions field printed by the -l option is followed by a '@' character. Otherwise, if the file or directory has extended security information (such as an access control list), the permissions field printed by the -l option is followed by a '+' character. ...


17

Short version: rm *\([1-9]\)* Do not pipe ls to xargs. Instead, pipe find ... -print0 to xargs -0, in order to avoid such problems. find . -maxdepth 1 -name '*([1-9])*' -print0 | xargs -0 rm ...which can be written as: find . -maxdepth 1 -name '*([1-9])*' -exec rm {} \; and: find . -maxdepth 1 -name '*([1-9])*' -delete which can further be ...


17

Ignacio Vazquez-Abrams has already explained about the *. As for the executable-looking emulator that you can't actually execute, this can happen when the dynamic loader requested by emulator doesn't exist. You can check what kind of file emulator is with the command file emulator, and check what dynamic loader and libraries it needs with ldd emulator (any ...


17

Note: Due to legacy licensing reasons, most GNU/Linux distributions don’t include the original vi program as written by Bill Joy. Instead, the vi command is provided by running Vim in vi-compatibility mode. The following answer is based on running Vim with its vi-compatibility mode. Modifying a read-only file Vim warns the user if they modify the buffer of ...


15

Here's a link to the source code. Note /* Root is -A automatically. */. This is a feature in Apple's version of BSD ls.


15

I'd use find dirname -not -empty -ls, assuming GNU find.


15

For a complete answer here is what I use: ls -lrth Put this in your startup script /etc/bashrc and assign an alias like this: alias l='ls -lrth' Restart your terminal and you should be able to type l and see a long list of files.


15

Try watch. Taken from here: watch -d ls -l A friend and I tried this a moment ago, it seems that the highlighting doesn't really work correctly, it will highlight a seemingly random selection. I've tried this in an OS X Terminal ssh'd to a RHEL5 machine and my friend has tried in a Ubuntu GUI terminal. Unfortunately inotifywait is not present on the ...


15

You can usels -d */, or ls -d .*/ for hidden directories.


14

See 'CONDITIONAL EXPRESSIONS' in man bash - in this case you want -h: for file in * do if [ -h $file ]; then echo $file fi done


14

It's a sparse file. ls is reporting the allocated size; du is reporting the amount of space actually used. As your torrent client downloads more it will fill in the gaps and the du-reported size will grow to match what ls reports.


14

Why can't I use a command like this to find all the pdf files in a directory and subdirectories? The wildcard *.pdf in your command is expanded by bash to all matching files in the current directory, before executing ls. How do I do it? (I'm using bash in ubuntu) find is your answer. find . -name \*.pdf is recursive listing of pdf files. ...



Only top voted, non community-wiki answers of a minimum length are eligible