Here are some possible answers, all using the 'open' command-line utility.
The -a option means "open the file argument with the named application":
open -a TextEdit file.txt
The -e option means "open the file argument with the TextEdit application":
open -e file.txt
The -t option means "open the file with the default application for editing text files, as determined via LaunchServices". By default, this will be /Applications/TextEdit.app; however, it's possible for this setting to get overridden:
open -t file.txt
Finally, any file that's of the "text" type will get opened by the application bound to the text type if you just say open file.txt
. You can use the "file" command to reveal what the operating system thinks the file type is: file file.txt
. So, for example, if you renamed "file.txt" to just "textfile" then open textfile
would still open it in the default text-file editing application, as long as file textfile
still thought that "textfile" was actually a text file.
A short 'help' file on open
can be found by running
open --help
Or you can read the whole manual with
man open
This is actually a feature of the filesystem of your disk, not bash or Terminal.app.
HFS+ (the Mac filesystem) is usually configured to be case insensitive but case preserving. This means that the file system will consider foo
and FoO
to be the same, but when you create a new file it will remember which letters where capitalized and which were not.
When you format a disk with HFS+ you can chose whether the file system should case sensitive or not. If you chose to format with UFS (Unix FileSystem) it is always case sensitive, AFAIK.
To check whether a disk is case sensitive, run:
diskutil info <device>
For example:
diskutil info disk0s2
Look for the Name:
line. If it reads something like Mac OS Extended (Case-sensitive, Journaled)
it means that it is case-sensitive. If it just reads Mac OS Extended
(without the Case-sensitive
) then it is only case preserving but not case sensitive.
Best Answer
The macOS version of
locate
doesn’t have aregex
option. You can use*
and?
in the search pattern but that’s it.Before you can use
locate
you will have to enable it (i. e. have thelocate
database built) using the following command—by default it is disabled: