Help UNIX noob here

Discussion in 'Computers and Technology' started by BirdofPrey, Feb 1, 2008.

Help UNIX noob here

Discussion in 'Computers and Technology' started by BirdofPrey, Feb 1, 2008.

  1. BirdofPrey

    BirdofPrey New Member

    Joined:
    Aug 20, 2007
    Messages:
    4,985
    Likes received:
    5
    Trophy points:
    0
    From:
    Arizona
    So I started a programming class at my university and the teacher wants us to use the school's UNIX server to compile and submit java programs. Now I figured out how to do 3 things (most importantly submitting th file) but I want to get more out of the system. Also I am doing remote acess using an SSH client so I don't have direct control over the system.

    Also I need to learn how to use VI since emacs dissapeard so if anyone could give me tips on that as well (how to move the cursor, how to save and exit) it would be nice.



    I am fluent in DOS so any connections you can mke between the two would be helpful. 3 major things I want ot know are
    How do I change the prompt from the server name and lne number to the current directory

    Does UNIX hav an equivalent of a batch file that can auto execute commads and how do I use one? (submitting the files requires me to type in a path that takes a whole line)

    How do I query the attributes of a command (equivalent to /? in DOS)?
     
  2. 11-Sodium

    11-Sodium New Member

    Joined:
    Dec 17, 2007
    Messages:
    194
    Likes received:
    0
    Trophy points:
    0
    The current directory should be displayed after the server's name, but /Users/username/ will likely be shortened to a ~. Any time cd is used after that will cause the directory displayed to change.

    I am not familiar with DOS, but the .bashrc and .bash_profile files are likely what you need. If you are using another shell, I probably won't be able to help much.
    Simply use vim in the home directory to open the .bashrc and .bash_profile files and save any commands you want to execute upon starting to the .bashrc file and add
    source ~/.bashrc
    to the .bash_profile. To set the path automatically, in the .bashrc file type in
    export PATH=
    and whatever path you need.

    To learn about commands, you should use
    man commandName
    or
    info commandName

    I think there is a way to make emacs run through vim, by typing in
    :!emacs %
    in command mode.

    Vim information can be found here:
    http://vimdoc.sourceforge.net/
    But if you don't want to delve through that then what you need to know is...

    In command mode:

    to write file (save), type
    :w

    to write and quit type
    ZZ

    to quit without writing
    :q!

    left, down, up, right are (assuming arrow keys don't work)
    h j k l

    to go into insert mode
    i

    to go into replace mode (one character, multiple)
    r R

    forward, backward through words
    w b

    to beginning, end of line
    ^ $

    go to line 1 (or any other line, substitute the number)
    1G

    go to eof
    G

    yank selected (similar to copy)
    y

    delete selected (similar to cut)
    d

    delete character, delete word, delete line (similar to cut)
    dl dw dd

    paste before, paste after
    P p

    undo last command
    u

    Once out of command mode, hit Esc to return to command mode.

    That should cover enough to allow you to get the job done, but there are many more features available. Also consider making a .vimrc to load your preferences.
    A few preferences I would include in a .vimrc:
    (if any of these cause some sort of error, remove them from the .vimrc)

    "line numbers visible
    set nu

    "autoindent and smartindent
    set ai
    set si

    "backspace works normally in insert mode
    set backspace=2


    I hope this was helpful, and covered what you needed to know.
     
  3. BirdofPrey

    BirdofPrey New Member

    Joined:
    Aug 20, 2007
    Messages:
    4,985
    Likes received:
    5
    Trophy points:
    0
    From:
    Arizona
    I amUsing SecureShell 3.2.9 and the arrow keys workin emacs (whic is now workng again) but not VI or the prompt

    Also How do I acess a local drive. The srver cluster I have to connect to dumps me onto my filespace on the server but I want to be able to acess txt files stored on my computer
     
  4. 11-Sodium

    11-Sodium New Member

    Joined:
    Dec 17, 2007
    Messages:
    194
    Likes received:
    0
    Trophy points:
    0
    Well, hjkl should work in VI if you plan on using it instead of emacs. It doesn't seem intuitive at first, but you can get used to it.

    To access a local file I think you would essentially have to upload the file to the server, if that is allowed.