Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I gedit something in Mac's Terminal [closed]

Tags:

macos

gedit

When I was using a Linux laptop as my dev machine, I used to do "gedit xxxx" in a Terminal. Now I just switched to MacBook, I d like to do the same thing.

I know that I can open gedit in a command line like "open gedit", but can I add the file name? Otherwise I have to use vim. I am not a fan of vim.

like image 459
Xi 张熹 Avatar asked Jan 26 '12 01:01

Xi 张熹


People also ask

How do you edit a file in Mac Terminal?

In the Terminal app on your Mac, invoke a command-line editor by typing the name of the editor, followed by a space and then the name of the file you want to open. If you want to create a new file, type the editor name, followed by a space and the pathname of the file.

Can I close Terminal on my Mac?

In the Terminal app on your Mac, choose Terminal > Quit Terminal.


2 Answers

Add

alias gedit="open -a gedit"

to ~/.bash_profile :

Now you'll be able to gedit directly from the command line.

like image 92
jwalk Avatar answered Sep 28 '22 07:09

jwalk


try:

open -a /path/to/gedit /path/to/file.txt
like image 32
prodigitalson Avatar answered Sep 28 '22 07:09

prodigitalson