Tag Info

Hot answers tagged

5

ls -A is the correct answer to your question, but not to the question you linked to (that question was about listing only hidden files and directories).


5

This usually indicates that the filesystem, specifically the meta data pertaining to that particular file has become corrupt. You could try performing a fsck on the disk, but I'd suggest doing this with the filesystem unmounted. Using /forcefsck You can usually schedule a check at the next reboot like so: $ sudo touch /forcefsck $ sudo reboot Using ...


4

Check your environment variable LC_COLLATE. The easiest thing will be to use the command locales. If you want, you can set it to a different value. For example, you can do (assuming bash) export LC_COLLATE="C" and that should fix your issue.


3

As Vivian suggested, the -t option of ls tells it to sort files by modification time (most recent first, by default; reversed if you add -r).  This is most commonly used (at least in my experience) to sort the files in a directory, but it can also be applied to a list of files on the command line.  And wildcards (“globs”) produce a list of files on the ...


3

It's the programmable completion feature of the shell. You can simply press the TAB key twice to gain this behavior. Imagine you type cd Downkoads/St and then press the TAB key. St will be completed to Stuff if it is the only folder starting with St. If there are other folders starting with St in there, you will get a list of them by pressing TAB twice. For ...


3

You just need to create a list of glob matching files, separated by space: for file in .* *; do echo "$file"; done Edit The above one can rewrite in different form using brace expansion for file in {.*,*}; do echo "$file"; done or even shorter for file in {.,}*; do echo "$file"; done Adding path for selected files: for file in /path/{.,}*; ...


2

Colors The coloring is controlled by the DIR_COLORS* files that reside under `/etc. For example on Fedora 19 I have the following 3 files: $ ls -l /etc/DIR_COLORS* -rw-r--r--. 1 root root 5004 Jan 20 2014 /etc/DIR_COLORS -rw-r--r--. 1 root root 5682 Jan 20 2014 /etc/DIR_COLORS.256color -rw-r--r--. 1 root root 4646 Jan 20 2014 ...


2

They were probably pressing tab twice to get filename completion. What exactly you are shown depends a bit on the shell: zsh, for example, can be configured to show you file date and size as well, and it is clever enough to only show you directories since you can't cd into a file anyway. Example of bash output: $ cd (tabtab) dira/ dirb/ file.txt ...


1

This does almost exactly what you want, except it leaves off the trailing / on the directory names. find . -maxdepth 2 -name file1.php -printf '%T@ %h (last modified %Td/%Tm/%TY %Tk:%TM)\n' \ | sort -k 1n | sed 's/^[^ ]* .\///' Credit where credit is due. This is adapted from shlck's answer here. Edit: All of my %A should have been %T


1

If you use the find command you can omit the files that end in the extension .gz like so: $ ls -l total 0 -rw-rw-r--. 1 saml saml 0 Oct 15 22:42 FAIL -rw-rw-r--. 1 saml saml 0 Oct 15 22:42 FAIL.gz $ find . -name "*FAIL*" ! -name "*.gz" ./FAIL You can also filter ls output like so: $ ls *FAIL* | grep -v '.gz' FAIL But it's generally advisable to not ...


1

You can test against the presence of a regex for those extensions: for file in *FAIL*; do [[ ! $file =~ .(bz2|gz) ]] && printf "%s\n" "$file"; done Insert obligatory warning about not parsing ls...


1

Every directory has at least two references: one from its parent directory (the Volumes entry in /), and one from its own . entry. If there are subdirectories, each has a .. entry that refers back to the parent, and those also contribute toward the parent's link count. So your /Volumes directory's link count of 9 consists of one from /, plus one from ...



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