TextEditでターミナルファイルを開く方法

TextEditでターミナルファイルを開く方法

nano <file_name>端末でファイルを開いたり編集したりします。しかし、編集が難しいですが、端末ファイルをTextEditで開く方法はありますか?

編集する:

open -a TextEdit <my_file_name>どちらもopen -a TextEdit次を返します。

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>返品:

Couldn't get a file descriptor referring to the console

ベストアンサー1

texteditUbuntuを使用しているので、既製のコマンドやアプリケーションはありません。

あなたの質問から:

  1. open -e settings.py osxでは、デフォルトのテキストエディタでPythonファイルを開くのではなく、Pythonファイルを実行します。open -t settings.pyデフォルトのテキストエディタを使用してPythonファイルを開くために使用されます。

  2. open -a TextEdit TextEditがまったく存在しないため(Macの場合)、Ubuntuでは機能しません。あなたの目的のためにgedit settings.py

  3. xdg-open settings.py Ubuntuではxdg-openを試してください。これは、openそのファイル形式に関連するネイティブアプリケーションを使用してファイルを開くMacコマンドと同じです。 Pythonファイルを開こうとすると、どのアプリケーションが実行されるのかわかりません。

おすすめ記事