|
|
|
||||||
|
Intro to UNIXWhat is Unix?Unix is a ubiquitous operating system which runs on many different kinds of computers. Unix is used around the world. In Unix users access the operating system via what is called a shell. The unix prompt, or shell prompt, is where you type your commands. Anything running on the machine (even the operating system itself) is called a process. Unix has been called confusing and a pain to learn, but it's also flexible and powerful. Logging inThe easist way to log in is to telnet from another computer. From a department mac, a unix option can usually be found on the apple menu. If not, you may have to find telnet, and then open a connection to mordor.stat.ohio-state.edu. When you get connected to the machine it will say: login: enter your username, then it should say: Password: enter your password. If you make a mistake, the machine will redisplay the login: prompt, and you will have to start over again. If this is your first login, the machine will make you choose a new password, after logging in. Once you log in, the machine will have you hit whatever key your keyboard uses to erase characters, and then it will display a prompt with the machine name (unix) in it. This is the unix prompt. Note: Your account is for your use only. On no occasion should you give or password to anyone, or let anyone use your account. Also you should be responsible in your use. Many other people depend on this machine to get their work done. Logging outTo logout just type exit, logout, lo, or the control and d characters, together. (This is called control-d or ^ d.) Editing filesemacs is the recommended editor, and can be invoked with emacs filename where filename is the name of the file you want to edit. A separate guide is available for emacs. Electronic mailpine is the recommended mail reader, and can be invoked with pine. A separate guide is not available for pine, but pine is fairly self explanatory, and has a decent help system. Help is available within pine, by giving pine a ?. Pine uses a directory called mail in your home directory. In this directory pine stores messages in files which it called folders. There are commands in pine for switching between folders, see the help system. Your e-mail address is: your_username@stat.osu.edu Basic Unix commandsThere are many, many unix commands, here only mentioned are the commands necessary to get started. Feel free to use the man command to find others. All the commands mentioned here have man pages. (And more options than you can imagine.) The first command to know is man. man is the unix help facility. It stands for manual. The entire unix manual is on line. To use man, type man command_name where command_name is the command you are interested in. If the manual information takes up more than one screen, the man command will pause and prompt you with with ``MORE----" at the bottom of the screen. A q quits and a space goes on. To quickly find several commands which may relate to a topic, use man -k topic where -k stands for keyword. For example, to find out what commands are related to the topic ``editor", you could try man -k editor. The result would be a list of all commands which contain the word ``editor" in their short summary. Other commands: ls list files in the current directory. ls -la will give you a long listing of all the files in the directory. cp original_filename copy_filename copy a file. mv original_filename new_filename move/rename a file. rm filename remove a file. quota -v display your current disk usage. more filename page through a file. mkdir dirname make a new directory off of the current directory. rmdir dirname remove a directory. cd dirname change the current directory to dirname. pwd print the current directory. Most likely this also appears above the unix prompt. lp print a file. You can only print text files, that is ones you can see with more. The printer's names are lw341, lw335, lw404, lw440, and lw212, depending on the room they are in. For example to print to the 341 printer, you would use: lp -dlw341 filename More advanced Unix commandsgrep pattern_string filename search for strings in a file. kill process_id terminate a process. ps get a list of the processes you are running. ps -ef lists all the processes on the system. Combined with grep this is a good way to find processes. top list all processes in a different format. rwho list all the users on the system. talk user talk to another user on the system. passwd change your password. Gotchas and other hintsYou can hit the tab key to complete a filename while at the shell prompt. Also, emacs commands can be used to recall and edit previous commands. Control-c will generally kill something that is currently running. However, control-z will only stop something, to kill it you need to type fg, and then control-c. (There are other ways as well, see tcsh or ps and kill) Control-s and control-q have traditionally been pause and unpause characters, so if you are stuck and think you might have hit control-s, try hitting control-q. Emacs uses control-s in the save command, so if this keeps freezing your screen, you will have to set your terminal program not to interpret them. In telnet on the Macs, this can be done by going under Session to Setup Keys and making them all blank. See the documentation on the web for more info. Compiling computer programsf77 is the fortran compiler, cc is C, CC is C++, and f90 is fortan 90. The compilers have similar options, as always read the man page if you are unsure. Here fortran is used as an example. To compile a program do: f77 prog.f This will create, assuming there are no errors, an executable called a.out, which you can then run by typeing a.out. To call the executable something else use the -o option, for example to call it prog do: f77 -o prog prog.f Note: the default C compiler is not ANSI C. If you have a program that requires ANSI C, you have to give the C compiler an option. Use cc -Aa prog.c. Where to go from hereProbably the best thing to do now is to log in and try some things out. All department documentation is available on the web. Or "Unix for the Impatient" and "An Introduction to Unix" are available in the SCL Office. |
|
If you have trouble accessing this page, or need an alternate format contact webmaster@stat.osu.edu. |