Edit A Text File In Terminal 11

Terminal

Share
Edit A Text File In Terminal

Hey

Here is a cool trick to enable you to edit text files in Terminal using a little applications called pico. Its really easy and the text editor is quite powerful. It is really simple to do and can open every file that you can open in text edit.

To enable yo to do this trick open up Terminal (Applications > Utilities > Terminal) on a new line type.

pico /path/of/file.txt

Give it a second or two and a text editor will open. As shown in the image below.


You can then edit then proceed to edit the text using the commands below. You can read through the help file associated if you need more help. By the way most commands are accessed through ctrl and a represented though the up arrow (^).


If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

  • Subscribe To Mac Tricks And Tips

11 Responses to “Edit A Text File In Terminal”

  1. 1

    I’m not really sure if I’d consider this a trick. Its about the same as saying that you have to run firefox…. to enable firefox….

    Also, as always, vim > all

    Comment By Anonymous on February 29th, at 12:20 am

  2. 2

    I agree. This is just a terminal app.

    and I prefer emacs or xemacs (you start them up the same way)

    Comment By Bingo on February 29th, at 5:47 am

  3. 3

    Thank you for reminding me about this fabulous text editor pico. I’m glad they included it on the mac.

    If you are a normal person that just wants to edit a text file without remembering weird keystrokes, pico is perfect.

    Comment By Rick on August 30th, at 11:39 pm

  4. 4

    Pice/nano same thing is my favourite editor. Although vim and emacs are better they are not as simple to use as nano.

    Comment By admin on August 31st, at 12:21 am

  5. 5

    nice tip, i use it to edit my settings in php and apache, to avoid getting errors on permission, type in sudo pico /path/file.ini

    Comment By paulo on February 6th, at 5:05 am

  6. 6

    You can always type the following in the shell…

    open -a TextEdit /path/of/file.txt

    Comment By Kevin on June 7th, at 12:23 am

  7. 7

    How about…

    $ open -e /path/of/file.txt

    The -e forces TextEdit.

    Comment By Ken on July 5th, at 3:40 am

  8. 8

    I use TextMate to edit all of my files because it is just far superior to TextEdit in my opinion.

    This is what I would suggest to do in order to make editing files in Terminal easier.

    Add the following line to .profile located in “/Users/username/”:
    alias edit='open -a TextMate'

    Now all you have to do to edit a file in Terminal is type:
    edit /path/to/filename

    In reality, you could make this open the text file with any application you wanted as long as you specified that in the alias statement in the .profile file.

    Comment By Jonathan on October 13th, at 4:49 pm

  9. 9

    Hey there! I know this is somewhat off topic but I was wondering if you knew where I could find a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having trouble finding one? Thanks a lot!

    Comment By Lanita Osterman on May 23rd, at 1:41 am

  10. 10

    Nice post and great job. Happy with that.

    Comment By make money on ebay for free on August 6th, at 12:48 pm

  11. 11

    does anyone know where the rc file is for the osx implementation of Nano?

    Comment By Robert Cox on October 10th, at 5:14 pm