Getting started


The basic cycle

  • Switch on your monitor.

  • Switch on your PC.

  • Allow the machine to boot. Wait till the login prompt comes.

  • Supply your login and password:
    Login: e<nn>
    Password: e<nn>
    
    Here <nn> is the number of your PC. This opens your window manager (usually KDE) with icons, the bottom panel and so on. You are now ready to start your work.

  • Click on the terminal icon to open a shell (command prompt).

  • Edit your program (new or already existing) by an editor. We recommend using the emacs editor. This is how you can run emacs:
    emacs myprog.c &
    
    (Note that the ampersand in the last command was not necessary, but is helpful in the sense that it runs emacs in the background and the shell is free to listen to your other commands.)

  • Write your program in the editor and save it.

  • Go to the shell and compile your program:
    cc myprog.c
    
    If compilation is successful, an executable called a.out will be created.

  • Run your program:
    a.out
    
    You may have to give the command ./a.out in case you are issued a message like a.out: Command not found.

  • Continue your edit-compile-debug-run-debug-print work.

    ...

    Finally, it's pretty late. It's time to pack up. Wait! You still have some more things to do, before you rush for your lunch.

  • Close all the windows you opened.

  • Logout from your window manager. This leaves you again in the login console.

  • Select the item to shut down the machine. Wait till the machine completely shuts down.

  • Switch off your monitor.

  • You can now leave. Don't remember later that you have forgot to sign the attendance sheet. You may not rely on our memory to certify in the next week that you were present in this lab session.


Some useful Unix commands

Here is a short list of useful commands that you can use from your shell (in addition to running emacs and compiling and running your program).

  • Create a directory:
    mkdir progs
    

  • Go to a new directory:
    cd progs/
    
    Every directory provides you access to two directories: . (the current directory) and .. (the parent directopry).

  • View a list of all files in a directory:
    ls -lF
    
    Note that ls -F, ls -l, ls -al, ls -alF etc and even simply ls also work. Try out and find the differences. In fact, the ls takes a lot of other options.

  • View the content of a file:
    cat filename
    

  • Copy one file to another:
    cp file1.c file2.c
    cp file2.c mydir/file3.c
    

  • Move a file to another:
    mv file1.c file2.c
    mv file2.c mydir/
    cd mydir/
    mv file2.c ../file1.c
    cd ../
    

  • Delete a file:
    rm filename
    
    Note: A deleted (by rm) or overwritten (by mv) file is lost for ever. In no way you can get it back. Be very, very careful, before running these commands.