Open full text files in terminal

Discussion in 'macOS' started by karohan, Dec 10, 2010.

  1. karohan macrumors 6502

    Joined:
    Jun 25, 2010
    #1
    How do you open/edit text files in the terminal such that I don't need to navigate through pages of the text file, I just want to see the whole file there so I can scroll up and down it (similar to the output with "cat").
     
  2. MisterMe macrumors G4

    MisterMe

    Joined:
    Jul 17, 2002
    Location:
    USA
    #2
    At the command prompt, type pico {complete path of file} [return]

    Easier alternative:
    1. At the command prompt, type pico
    2. Drag the file from its folder window to the Terminal window.
    3. Press [return]

    If you have an editor that you prefer over pico, substitute its name wherever you see pico above.
     
  3. karohan thread starter macrumors 6502

    Joined:
    Jun 25, 2010
    #3
    I tried Pico, but the view forces me to navigate through large text files by changing the "page". I can't simply scroll through the content, which is easier for me. Are there any alternative editors that have such a view in terminal?
     
  4. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #4
    That's simply not how Terminal works so you won't find anything most likely. Just use a different editor like MacVim, TextWrangler, Emacs, or whatever.
     
  5. miles01110 macrumors Core

    miles01110

    Joined:
    Jul 24, 2006
    Location:
    The Ivory Tower (I'm not coming down)
    #5
    No. Even the editors that allow you to move the cursor will "jump" to the next page upon reaching the bottom of the previous one. You are looking for a GUI text editor, apparently.
     
  6. fwhh macrumors regular

    Joined:
    Aug 11, 2004
    Location:
    Berlin, Germany
    #6
    I guess, you didn't understand the concept of the terminal. The scrollbar on the terminal window just shows you a kind of terminal-output history. Only the last part of this windows is the actual terminal. For an editor you may want to try the old-school "vi" (or actually vim):type
    Code:
    vi textfile
    Use "i" to enter the edit mode, ESC to switch to command mode.
    ":q!" quits without saving, "ZZ" saves the file to disk. Refer to "man vi" for more infos.
    But if you want to open a file for editing, you can also use
    Code:
    open textfile
    (default app) or
    Code:
    open textfile -a smultron
    (e.g. open file with smultron)
    and, most handy:
    Code:
    open .
    view current folder in finder.
     

Share This Page