Hot answers tagged


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


It 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 ...


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' Given that I'm more comfortable with my linux CLI apps, I tend to also update coreutils on OSX : brew install coreutils alias ls='/usr/local/bin/gls --color -h --group-...


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


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 ...


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.


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


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.


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.


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 +-last ...


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 ...


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 ...


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


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.


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.


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)


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, the ...


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: 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 ...


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 ...


Open the terminal window and type: alias ls='ls -G' Then hit Enter and done!


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


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.


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


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. ...


From info ls: `-F' `--classify' `--indicator-style=classify' Append a character to each file name indicating the file type. Also, for regular files that are executable, append `*'. The file type indicators are `/' for directories, `@' for symbolic links, `|' for FIFOs, `=' for sockets, `>' for doors, and nothing for regular ...


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 ...


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 ...


I use sometime this: find . -type f -mmin -5 -print0 | xargs -0 /bin/ls -tr or find . -type f -mmin -5 -print0 | xargs -0 /bin/ls -ltr to look recursively about which files was modified in last 5 minutes. ... or now, with recent version of GNU find: find . -type f -mmin -5 -exec ls -ltr {} + ... and even for not limiting to files: find . -mmin -5 -...


The more simple way is: ls --full-time which is equal to ls -l --time-style=full-iso If you want to show entries as hidden files starting with ., add -a: ls --full-time -a

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