How to open a terminal file in TextEdit
Since you're on Ubuntu, there is no textedit
command or application out of the box.
From your question:
open -e settings.py
On osx, this would execute the python file instead of opening it in your default text editor. Useopen -t settings.py
to open the python file with the default text editor.open -a TextEdit
This doesn't work op Ubuntu because TextEdit simply doesn't exist (works on mac). For your purpose, trygedit settings.py
xdg-open settings.py
On Ubuntu, try xdg-open. This is the equivalent of Macs'open
command which opens any file with the associated default application for the file type. I'm not sure what application would launch if you try to open a python file though.
Related videos on Youtube
Zorgan
Updated on September 18, 2022Comments
-
Zorgan over 1 year
I use
nano <file_name>
to open/edit files on terminal. However it's very hard to edit so is there a way to open terminal files in TextEdit?EDIT:
open -a TextEdit <my_file_name>
andopen -a TextEdit
both return this:open: invalid option -- 'a' Usage: open [OPTIONS] -- command This utility help you to start a program on a new virtual terminal (VT). Options: -c, --console=NUM use the given VT number; -e, --exec execute the command, without forking; -f, --force force opening a VT without checking; -l, --login make the command a login shell; -u, --user figure out the owner of the current VT; -s, --switch switch to the new VT; -w, --wait wait for command to complete; -v, --verbose print a message for each action; -V, --version print program version and exit; -h, --help output a brief help message.
open -e <my_file_name>
returns:Couldn't get a file descriptor referring to the console
-
Tamerz over 6 years
open -a TextEdit filename
Taken from: apple.stackexchange.com/questions/25844/… -
Zorgan over 6 yearsBoth not working for me (shown in my edit). Any idea why?
-
Tamerz over 6 yearsIt looks like you have something called
openvt
installed that perhaps is linked asopen
? What happens if you runwhich open
? By default on OSX it should point to/usr/bin/open
. What happens if you try/usr/bin/open -a TextEdit filename
? -
Zorgan over 6 yearsMy server is set like this:
/home/user/project_name/env/bin
so I did/james/postr/env/bin/open -a TextEdit settings.py
which returned-bash: /james/postr/env/bin/open: No such file or directory
. There is noopen
file in mybin
directory. -
Zorgan over 6 yearsI tried the alternate method in the link you posted - I added
alias textedit='open -a TextEdit'
to my.profile
. After that I tested it withtextedit settings.py
and it returnedThe program 'textedit' is currently not installed. You can install it by typing: sudo apt install xview-clients
. So I installed it - but after I triedtextedit settings.py
again, it returnedXView error: Cannot open connection to window server: :0 (Server package)
. Any idea? -
Tamerz over 6 yearsI'm confused, what are you using? You have this tagged as
osx
but it is telling you aboutapt install
which sounds like some type of Debian/Ubuntu OS. -
Zorgan over 6 yearsSorry I forgot to mention this is on Ubuntu 16.04 on my remote Digital Ocean server. The method you told me works on offline on my Mac OSX.
-
dan over 3 yearsPlease fix your tags so as to avoid wasting your time and the time of colleagues who try to help.
-