CS551 Minix Commands (FAQ)



What command do I use if I want to ... ?
Can I print ?
Can I use dos floppies or do I have to format new ones for MINIX ?
How do I mount my floppy ?
How do I compile ?
What programs are running at the moment ?
Which editor can I use ?
How do I reboot/shutdown the machine properly? 
Where is this variable instantiated ?

Manual pages

These pages provide detailed information about commands and their usage. Also standard C language system calls, libraries definitions can be found here.

        man ls       (information on the command ls)
        man man  ( information on how to use man)
 

 Printing

lp test.c
prints test.c file to your printer. type man lp to get more info.

Floppies

You can use dos formatted floppies to transfer files to and from MINIX  using the dosread command :
 
        dosread -a fd0 prog.c > myprog.c    ( copying prog.c from floppy  to current directory as myprog.c)
        doswrite fd0 test.c < prog.c             ( copy prog.c from MINIX to floppy as test.c)
        dosdir -l fd0                                      ( show the files of a dos floppy )

You could format your disks though with

        format /dev/fd0 720 : formats 720 KB diskettes on floppy A
        format /dev/fd0 1440 : formats 1440 KB diskettes on floppy A
and then use

        mkfs /dev/fd0 : makes file system on floppy A
to create teh minix filesystem on the floppy .

Now in order to transfer files you will have to mount the floppy on the MINIX filesystem

        mount /dev/fd0 /fd0
the directory /fd0  will be contain the information on your floppy. By copying files to this directory you are essentially copying files to the disk.
Remember though to unmount your disk after you have finished copying files to your floppy media
        umount /dev/fd0
 

Compiling

To compile files in a directory, you can do several things. Compilation of OS takes sometimes quite a long time on slower machine. make is the command to compile source in the system. It looks for "Makefile" and executes this file. "Makefile" simply keeps the file names and their compilation rules in text format. make also checks the date of files. If compiled date of a file is older than the source file or ".o" file of this file doesn't exist in the directory, it compiles the file otherwise it skips the file. You need to monitor this compilation process. Each modified file is compiled first, then linked together. If something goes wrong with this process you should delete all the ".o" files, then recompile again. If make can't compile, you can also check the date of files. They cannot be future dates !!!!

To compile

Processes

Using the ps  command you can view processes that are currently running on your machine along with their PID if you need to manually terminate one of them.

Editor

VI  is the MINIX editor.Basic vi commands can be found here, for more on this editor follow this link.

Shutdown/Reboot

You could use
    reboot
or
    shutdown -r now
to reboot the machine.
    shutdown -h now
will shutdown the machine in order to turn it off.

Grep

If you want to find out in which other file you can find the string "pid" you could use :
    grep pid *.c
This will look into all the files in the current directory with extension .c for the string pid
and output the name of the file and the line that contains pid. Look up grep in the man pages for more information on this powerful command.