This article describes how to open a file from a terminal emulator in Mac, Linux, and Windows.
Mac (macOS)
To open any file from the command line with the default application, just type open followed by the filename/path. Example: open /Desktop/filename.mp4 Edit: as per Johnny Drama's comment below, if you want to be able to open files in a certain application, put -a followed by the application's name in quotes between open and the file. Open your terminal application - Applications - Utilities - Terminal.app Type the following or copy this into your terminal app and then press enter: chflags nohidden /Library/ Exit the terminal by typing in exit or just close it. After doing that, follow the path that I gave you above in my other reply. Mac Snow Leopard makes it easy for you to create and edit your text files, such as word-processing files. Text files let you create and format documents that include text and photos and even embed music and video files for Web pages you build. Virtually every computer ever built can read and write in standard. You can open up Terminal on your Mac (perhaps by opening Spotlight on your Mac with Command⌘-Space key combination and type “Terminal”. Traverse to a folder you want to work in (documents will do, but it might get a little bit messy!). You can move through the text editor using the cursor keys, or JKJL.
Use open
command in Terminal. By running
Readme.txt opens with an application associated with Readme.txt. URL can be specified. For example,
opens Google website with your default web browzer. A directory can also be specified. For example,
opens current directly in Finder.
Sometimes you may want to open a file with a program which is different from the associated one, for example, when you want to edit html file with a text editor. By using -t
option, you can open a file with a default text editor.
You can also open a file with a specified application by using -a
option.
You can make a shell script to open a file with your favorite text editor. For example, to open a file with Brackets, make a text file br
like this,
Open Textedit From Terminal Mac Os
make it executable (chmod +x br
) and put in your path (check it by echo $PATH
). Then you can use the br
command as
Following help is shown by open --help
.
With cdto you can add a toolbar in the Finder to open the current directory in the Terminal.
Linux
Textedit For Mac
xdg-open
can be used to open a file with default applications. xdg-open is a part of xdg-utils.
This command is a little bit too long to type, and therefore you may want to create alias such as
in .bashrc
. In Gnome, gnome-open
is also available.
- gnome-open - manual page at Ubuntu xenial
Windows
Open Textedit Mac
start
command can be executed from command prompt, and Invoke-Item
command is used for PowerShell. See following documents by Microsoft for detail.
Comments are closed.