Tag Info

Hot answers tagged

515

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


77

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'


53

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.


45

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


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


34

ls is actually separate from Bash. 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.


33

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


31

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


30

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


29

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.


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


18

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.


17

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


16

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


15

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


15

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


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


14

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


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


13

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


13

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.


13

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


12

In both Windows and Linux there is a command called tree. In windows, the tree command (or tree /A /F) creates something like this: ├───plugins │ ├───dbcopy │ │ └───util │ ├───mssql │ │ └───gui │ ├───oracle │ │ └───gui │ ├───refactoring │ │ └───gui │ └───sqlscript │ └───prefs └───test In Ubuntu 10.04 you have to install ...


12

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.


12

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


11

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


11

Ubuntu (12.04, probably other version as well) by default features with alias ll='ls -alF' And as others have explained, -F is responsible for the asterisk. Edit: by the way, you are stating you're running ls -l, running ll may not be the same at all.



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