If you are working on the Mac Terminal and want to see the contents of a file on an external app like TextEdit (default text editor for macOS) then you can make use of the open command.
Open File in TextEdit
% open -a TextEdit ~/Desktop/sample.txt

In a similar way if you have other Text Editors installed on your Mac you can open files with them as well,
Open File in Sublime Text
% open -a TextEdit ~/Desktop/sample.txt

Open File in Default Text Editor
% open ~/Desktop/sample.txt
You do not need to pass in any options with open command to open the file in the default text editor.
Note: You can open any type of file using the open command, let's try to open an mp4 video file.
% open ~/Documents/holiday.mp4

-
Have Questions? Post them here!
More Posts related to MacOS,
- Opening mac Terminal
- How to change default macOS Terminal Window size
- How to clear Mac Terminal screen
- Find Hostname of Mac running on macOS Ventura 13
- Installing MongoDB on Linux/Unix/macOS/Ubuntu
- How to switch from bash to zsh shell in macOS Terminal
- Limit scrollback rows in macOS Terminal
- How to Set Background Wallpaper on macOS 13 Ventura
- This operation couldnt be completed. Unable to locate a Java Runtime. [macOS]
- Encode or Decode Base64 String using Mac Terminal Command
- List of All Apple Silicon ARM Based M1/M2 Mac [updated Oct 2022)
- How to remove Siri from Menu Bar [macOS Big Sur]
- Must Know Homebrew Commands for Mac/Linux Users
- Hide Keyboard Text Input Icon on macOS Ventura Menu Bar
- 13.0 MacOS Ventura release date
- How to change the default location of Mac Screenshot
- How to set Out Of Office (OOO) on Outlook for Mac
- 30+ Zoom video communications application shortcuts for macOS
- How to install wget on macOS
- Mac turn dark mode on or off using terminal command
- Create Symbolic Link using Terminal Command
- Mac - How to Install VirtualBox
- How to Enable or Disable Dark Mode on macOS Ventura 13
- How to install homebrew (brew) on M1 Mac
- How to uninstall Microsoft Outlook on Mac
More Posts:
- Implementing Android Text to Speech Example - Android
- How to install Microsoft Outlook App on Mac - MacOS
- Detect Data roaming in Android Application - Android
- WhatsApp Keyboard shortcuts for Mac - WhatsApp
- Command to know the installed Debian version? - Linux
- Error 50057 - User account is disabled. The account has been disabled by an administrator [Microsoft - Teams - Azure] - Microsoft
- How to insert date, time or custom timestamp in Notepad++ - NotepadPlusPlus
- How to minimize all Windows in Mac - MacOS