0

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> and open -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
8
  • open -a TextEdit filename Taken from: apple.stackexchange.com/questions/25844/…
    – Tamerz
    Feb 6, 2018 at 11:25
  • Both not working for me (shown in my edit). Any idea why?
    – Zorgan
    Feb 6, 2018 at 12:06
  • 1
    It looks like you have something called openvt installed that perhaps is linked as open? What happens if you run which open? By default on OSX it should point to /usr/bin/open. What happens if you try /usr/bin/open -a TextEdit filename?
    – Tamerz
    Feb 6, 2018 at 12:12
  • 1
    I'm confused, what are you using? You have this tagged as osx but it is telling you about apt install which sounds like some type of Debian/Ubuntu OS.
    – Tamerz
    Feb 7, 2018 at 6:10
  • 1
    Please fix your tags so as to avoid wasting your time and the time of colleagues who try to help.
    – dan
    Sep 8, 2020 at 6:32

1 Answer 1

1

Since you're on Ubuntu, there is no textedit command or application out of the box.

From your question:

  1. open -e settings.py On osx, this would execute the python file instead of opening it in your default text editor. Use open -t settings.py to open the python file with the default text editor.

  2. open -a TextEdit This doesn't work op Ubuntu because TextEdit simply doesn't exist (works on mac). For your purpose, try gedit settings.py

  3. 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.