Command to edit a file in terminal

Discussion in 'Mac Basics and Help' started by tidyboy, Dec 15, 2006.

  1. macrumors newbie

    Joined:
    Dec 10, 2006
    Location:
    Coventry UK
    #1
    hey guys

    how do I edit a file in a terminal. What is the command?


    Many Thanks
     
  2. macrumors G4

    Joined:
    Mar 4, 2006
    #2
    Depends on what text editor you want to use. Personally I use vi, but it's a bit UNIX-y for traditional Mac folks.

    Command would either be "vi <filename>" or "sudo vi <filename>" for system config files.

    You can also use the Open command to open TextEdit, although that's not strictly in the Terminal, it just opens TextEdit from within it. "Open /Applications/TextEdit.app <filename>" will do the biz there.
     
  3. Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #3
    If you prefer an editor that isn't used to spell 'evil', then try using pico.
    For example:

    sudo pico /etc/named.conf
     
  4. thread starter macrumors newbie

    Joined:
    Dec 10, 2006
    Location:
    Coventry UK
    #4
    Thankyou :)
     
  5. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #5
    tidyboy, since you have been asking about terminal commands, you may find this site valuable as you learn. Its just a bunch of man pages for the various commands.

    http://www.ss64.com/osx/
     
  6. Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #6

Share This Page