Results 1 to 3 of 3

Thread: *nix and vi high level overview

  1. #1
    Senior Member
    Join Date
    Jul 2001
    Posts
    420

    *nix and vi high level overview

    Hi All,

    I work with a group of people doing SAP ERP work -some of whom have a mainframe background. Recently my team began impelmenting a tool that works on the Unix level (SAP Business Connector). Many of the mainframers where coming to me for help with Unix. I created the document below. The first section is basic unix commands that they need frequently (most of which have been covered in other tutorials) the second section covers vi. The vi section is a great reference (I forget a command from time to time). I searched for previous post on editors (vi search not possible keyword too search) and did not see any general help on the topic. I hope you all find it useful.
    Unix Commands

    cd / go to root directory
    cd /<path> go to directory from root
    cd <dir> go to local sub directory

    ls –lrt list all items showing type (directory, symbolic link, etc) owner, group, size, timestamp, name. In reverse chronological order.

    ps list all processes running under logon id
    ps –ae list all process now running

    su - <UID> set user ID to a different ID
    su – set user ID to root –we will not have access to this

    man <command> help on the command

    rm <filename> delete the file
    rm –f <filename> force the delete
    rm –rf <filename> recursive force delete of the filename this can be dangerous use it sparingly

    mkdir - Creating a Directory

    more - Displaying the Contents of a File
    tail - Displaying the End of a File
    mv - Moving Files or Renaming Files
    cp - Copying a file
    vi <filename> Unix editor

    vi commands from http://www.chem.brown.edu/instructions/vi.html#cursor
    Complete Documentation
    The vi editor is a common editor for unix systems in that it makes use of a regular keyboard with an escape key. On the DECstation, the escape key is the F11 key. It therefore works on all unix computers. Complete documentation is available by typing

    man vi

    at the unix prompt.
    Starting an Editing Session

    vi filename

    where filename is the name of the file to be edited.
    Undo Command
    u
    undo the last command.
    Screen Commands
    CTL/l
    Reprints current screen.
    CTL/L
    Exposes one more line at top of screen.
    CTL/E
    Exposes one more line at bottom of screen.
    CTL/F
    Pages forward one screen.
    CTL/B
    Pages back one screen.
    CTL/D
    Pages down half screen.
    CTL/U
    Pages up half screen.
    Cursor Positioning Commands
    j
    Moves cursor down one line, same column.
    k
    Moves cursor up one line, same column.
    h
    Moves cursor back one character.
    l
    Moves cursor forward one character.
    RET
    Moves cursor to beginning of next line.
    0
    Moves cursor to beginning of current line.
    $
    Moves cursor to end of current line.
    SPACE
    Moves cursor forward one character.
    nG
    Moves cursor to beginning of line n. Default is last line of file.
    0
    Moves the cursor to the first character of the line.
    :n
    Moves cursor to beginning of line n.
    b
    Moves the cursor backward to the beginning of the previous word.
    e
    Moves the cursor backward to the end of the previous word.
    w
    Moves the cursor forward to the next word.
    /pattern
    Moves cursor forward to next occurrence of pattern.
    ?pattern
    Moves cursor backward to next occurrence of pattern.
    n
    Repeats last / or ? pattern search.
    Text Insertion Commands
    a
    Appends text after cursor. Terminated by escape key.
    A
    Appends text at the end of the line. Terminated the escape key.
    i
    Inserts text before cursor. Terminated by the escape key.
    I
    Inserts text at the beginning of the line. Terminated by the escape key.
    o
    Opens new line below the current line for text insertion. Terminated by the escape key.
    O
    Opens new line above the current line for text insertion. Terminated by the escape key.
    DEL
    Overwrites last character during text insertion.
    ESC
    Stops text insertion. The escape key on the DECstations is the F11 key.
    Text Deletion Commands
    x
    Deletes current character.
    dd
    Deletes current line.
    dw
    Deletes the current word.
    d)
    Deletes the rest of the current sentence.
    D, d$
    Deletes from cursor to end of line.
    P
    Puts back text from the previous delete.
    Changing Commands
    cw
    Changes characters of current word until stopped with escape key.
    c$
    Changes text up to the end of the line.
    C, cc
    Changes remaining text on current line until stopped by pressing the escape key.
    ~
    Changes case of current character.
    xp
    Transposes current and following characters.
    J
    Joins current line with next line.
    s
    Deletes the current character and goes into the insertion mode.
    rx
    Replaces current character with x.
    R
    Replaces the following characters until terminated with the escape key.
    Cut and Paste Commands
    yy
    Puts the current line in a buffer. Does not delete the line from its current position.
    p
    Places the line in the buffer after the current position of the cursor.
    Appending Files into Current File
    :R filename
    Inserts the file filename where the cursor was before the ``:'' was typed.
    Exiting vi
    ZZ
    Exits vi and saves changes.
    :wq
    Writes changes to current file and quits edit session.
    :q!
    Quits edit session (no changes made).
    If you spend more on coffee than on IT security, you will be hacked. What\'s more, you deserve to be hacked.
    -- former White House cybersecurity adviser Richard Clarke

  2. #2
    Senior Member
    Join Date
    Jul 2001
    Posts
    420

    *nix and vi high level overview

    Hi All,

    I work with a group of people doing SAP ERP work -some of whom have a mainframe background. Recently my team began impelmenting a tool that works on the Unix level (SAP Business Connector). Many of the mainframers where coming to me for help with Unix. I created the document below. The first section is basic unix commands that they need frequently (most of which have been covered in other tutorials) the second section covers vi. The vi section is a great reference (I forget a command from time to time). I searched for previous post on editors (vi search not possible keyword too search) and did not see any general help on the topic. I hope you all find it useful.
    Unix Commands

    cd / go to root directory
    cd /<path> go to directory from root
    cd <dir> go to local sub directory

    ls –lrt list all items showing type (directory, symbolic link, etc) owner, group, size, timestamp, name. In reverse chronological order.

    ps list all processes running under logon id
    ps –ae list all process now running

    su - <UID> set user ID to a different ID
    su – set user ID to root –we will not have access to this

    man <command> help on the command

    rm <filename> delete the file
    rm –f <filename> force the delete
    rm –rf <filename> recursive force delete of the filename this can be dangerous use it sparingly

    mkdir - Creating a Directory

    more - Displaying the Contents of a File
    tail - Displaying the End of a File
    mv - Moving Files or Renaming Files
    cp - Copying a file
    vi <filename> Unix editor

    vi commands from http://www.chem.brown.edu/instructions/vi.html#cursor
    Complete Documentation
    The vi editor is a common editor for unix systems in that it makes use of a regular keyboard with an escape key. On the DECstation, the escape key is the F11 key. It therefore works on all unix computers. Complete documentation is available by typing

    man vi

    at the unix prompt.
    Starting an Editing Session

    vi filename

    where filename is the name of the file to be edited.
    Undo Command
    u
    undo the last command.
    Screen Commands
    CTL/l
    Reprints current screen.
    CTL/L
    Exposes one more line at top of screen.
    CTL/E
    Exposes one more line at bottom of screen.
    CTL/F
    Pages forward one screen.
    CTL/B
    Pages back one screen.
    CTL/D
    Pages down half screen.
    CTL/U
    Pages up half screen.
    Cursor Positioning Commands
    j
    Moves cursor down one line, same column.
    k
    Moves cursor up one line, same column.
    h
    Moves cursor back one character.
    l
    Moves cursor forward one character.
    RET
    Moves cursor to beginning of next line.
    0
    Moves cursor to beginning of current line.
    $
    Moves cursor to end of current line.
    SPACE
    Moves cursor forward one character.
    nG
    Moves cursor to beginning of line n. Default is last line of file.
    0
    Moves the cursor to the first character of the line.
    :n
    Moves cursor to beginning of line n.
    b
    Moves the cursor backward to the beginning of the previous word.
    e
    Moves the cursor backward to the end of the previous word.
    w
    Moves the cursor forward to the next word.
    /pattern
    Moves cursor forward to next occurrence of pattern.
    ?pattern
    Moves cursor backward to next occurrence of pattern.
    n
    Repeats last / or ? pattern search.
    Text Insertion Commands
    a
    Appends text after cursor. Terminated by escape key.
    A
    Appends text at the end of the line. Terminated the escape key.
    i
    Inserts text before cursor. Terminated by the escape key.
    I
    Inserts text at the beginning of the line. Terminated by the escape key.
    o
    Opens new line below the current line for text insertion. Terminated by the escape key.
    O
    Opens new line above the current line for text insertion. Terminated by the escape key.
    DEL
    Overwrites last character during text insertion.
    ESC
    Stops text insertion. The escape key on the DECstations is the F11 key.
    Text Deletion Commands
    x
    Deletes current character.
    dd
    Deletes current line.
    dw
    Deletes the current word.
    d)
    Deletes the rest of the current sentence.
    D, d$
    Deletes from cursor to end of line.
    P
    Puts back text from the previous delete.
    Changing Commands
    cw
    Changes characters of current word until stopped with escape key.
    c$
    Changes text up to the end of the line.
    C, cc
    Changes remaining text on current line until stopped by pressing the escape key.
    ~
    Changes case of current character.
    xp
    Transposes current and following characters.
    J
    Joins current line with next line.
    s
    Deletes the current character and goes into the insertion mode.
    rx
    Replaces current character with x.
    R
    Replaces the following characters until terminated with the escape key.
    Cut and Paste Commands
    yy
    Puts the current line in a buffer. Does not delete the line from its current position.
    p
    Places the line in the buffer after the current position of the cursor.
    Appending Files into Current File
    :R filename
    Inserts the file filename where the cursor was before the ``:'' was typed.
    Exiting vi
    ZZ
    Exits vi and saves changes.
    :wq
    Writes changes to current file and quits edit session.
    :q!
    Quits edit session (no changes made).
    If you spend more on coffee than on IT security, you will be hacked. What\'s more, you deserve to be hacked.
    -- former White House cybersecurity adviser Richard Clarke

  3. #3
    Junior Member
    Join Date
    Sep 2001
    Posts
    8
    vi in a nutshell from O'Reilly is good to have around as well

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •