University of California at Berkeley Department of Electrical Engineering & Computer Sciences Instructional Support Group /share/b/pub/termtype.help /share/b/pub/keyboard.help /share/b/pub/dotfiles.help /share/b/pub/unix.help Apr 29 2008 Hints for Configuring a UNIX User Interface ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CONTENTS: Logging into UNIX Computers UNIX Configuration files UNIX commands Remapping the keys on the UNIX keyboard UNIX Shell Programs Changing your UNIX prompt SunRay UNIX and PC keyboards Here is some information about UNIX files and commands that can be used to setup your terminal emulation type and keyboard settings. Logging into UNIX Computers --------------------------- There are UNIX workstations in the EECS Instructional labs: http://inst.eecs.berkeley.edu/~inst/iesglabs.html These have an "XWindows" graphical interface, but most of the commands you run are typed into a text-based window called a "Command", "Terminal" or "Shell" window. You may need to find this window on a menu that pulls up from the bottom of the graphical interface or appears when you press the right button on the mouse. There are also UNIX servers that you can login to from other computers: http://inst.eecs.berkeley.edu/cgi-bin/clients.cgi?choice=servers To login from other UNIX computers, use the "ssh" command: http://inst.eecs.berkeley.edu/cgi-bin/pub.cgi?file=ssh.help To login from Windows computers, use the "putty" command: http://inst.eecs.berkeley.edu/cgi-bin/pub.cgi?file=putty.help UNIX Configuration files ------------------------ In your UNIX home directory, there are a number of configuration files that can influence how your screen and keyboard behave. The default files for EECS Instructional accounts are available in the directories /share/b/default-named-account/ (for NAMED accounts) ~$MASTER/adm/ (for CLASS accounts) These are executed either as you log in or when you start a program: .login .cshrc These are the most important. They are used by the csh and tcsh shells. The "tset" and "stty" commands are generally run from the .login file. .bashrc .bash_profile These are used by the bash shell. .twmrc .Xdefaults .xsession .dtprofile These are configuration files for X Windows features. There are many "man" pages; you can list them all with "man -k X11", "man -k cde", "man Xsgi". There are more details in the file /share/b/pub/XWindows.help on the EECS Instructional systems. .joverc .emacs elm/.elmrc .mailrc .pinerc These are the configuration files for common editors (jove, emacs) and mail readers (mail, Elm, pine). See the "man" pages for these programs for more information. You can replace your dot files with the default ones for new accounts by copying them from /share/b/default-named-account/. UNIX commands ------------- These commands can be used to setup your screen and keyboard. If you are unfamiliar with them, it is best to experiment carefully and not insert any changes into your configuration files until you know they work. stty: You can customize for the keyboard you are on by using the "stty" command. For example, to set the [BackSpace] key to perform the delete function, type: stty erase [BackSpace] that is, after "stty erase " press the key you want to set to that function. To some degree it is a matter of preference which keys should do what. This can be added to your .cshrc file so it is automatically run when you login. See "man stty" and "man tset" if you want to explore this further. set term = {termtype} setenv TERM {termtype} The term and TERM environment variables are used by some programs to determine what type of terminal you have. The most common termtypes for EECS Instructional users are "vt100", "xterm" and "dtterm". set filec The 'filec' option causes the escape key to trigger as a filename completion function, in the csh and tcsh shells. (The bash shell uses a double-tap on the escape key, and this feature is build in so you don't need 'set filec' in bash.) tset: In your .login file, the "tset" command is generally set to ask you for your terminal type when you login. See "man tset" for other features. Remapping the keys on the UNIX keyboard --------------------------------------- Keyboards from various vendors are arranged differently, and users may have preferred keyboard behaviors depending upon their experience and the software they run. So we generally do very little modifications to the default behavior that the vendors provide and let the user decide how to customize. The typical commands for doing this are "stty" and "xmodmap". The "xmodmap" is for use with XWindows and can modify one window at a time; "stty" modifies the keyboard for everything that is happening in the current login (windows or not). Typically, "stty" is used to set the preferred interrupt and backspace keys and to prevent background jobs from stalling if they need to display to the terminal. These are the commands for that: stty intr stty erase stty -tostop Here are "xmodmap" commands that assign the Dvorak keyboard layout to your UNIX shell and reassign it to the standard QWERTY layout that is printed on most keyboards: xmodmap /share/b/pub/dvorak.keymap xmodmap /share/b/pub/qwerty.keymap To enable the Dvorak keyboard for Windows2000, select Control Panel -> Regional Options -> Input Locales -> Properties -> "United States-Dvorak" For XP and 2003, it's in Control Panel -> Regional Options -> Languages -> Advandced. You will then need to click Add and select United States-Dvorak For Mac OSX, Select Preferences -> International and add Dvorak. Here is an "xmodmap" command that assigns the delete function to the "Delete char" key on an HP keyboard: xmodmap -e "keycode 111 = Delete" Here is an "xmodmap" command that make the mouse buttons "left-handed": xmodmap -e "pointer = 3 2 1 4 5" The standard interrupt keystroke in UNIX in [control-C], that is, the "control" (or "ctnl") key and the "C" key pressed together. Modem users may need to explore other "stty" options. CS Lower Division class accounts often have keyboard mappings set for them, especially for the use of Emacs and STk, scheme or scm. For more information, type these UNIX commands: man -M /usr/man stty man -M /usr/sww/unsupported/X11R6/man xmodmap and here are good references: http://www.xfree86.org/4.2.0/xmodmap.1.html http://web.mit.edu/answers/xwindows/xwindows_xmodmap.html UNIX Shell Programs ------------------- The UNIX "shell" is the program that is running that gives you a command line prompt, interprets what you type there and executes other programs that you type at the prompt. You can see which shell you have by typing /share/b/adm/bin/ildap passwd $USER That is your colon-delimited password entry; the last entry is the shell. You can change your shell by logging into update.eecs.berkeley.edu. The shells have different features. These are the typical UNIX shell programs on our computers, listed more or less in order of popularity: /bin/csh for help, type "man csh" /usr/local/bin/tcsh for help, type "man tcsh" /usr/local/bin/bash for help, type "man bash" /usr/local/bin/zsh for help, type "man zsh" /bin/ksh for help, type "man ksh" /usr/local/bin/rrsh restricted shell, used for CVS group accounts Changing your UNIX prompt ------------------------- In the "csh" shell, you can change your prompt to something like this: cory:/home/aa/staff/jdoe> By adding this to your .cshrc file: set hname = `hostname | sed 's/\..*//'` set prompt = $hname":$cwd> " alias cd 'set old="$cwd"; chdir \!*; set prompt = $hname":$cwd> "' Note that if you mess up that file, you may not be able to login, so test it before logging out, with the command source .cshrc You can copy the default .cshrc back into your home dir this way: cp /share/b/default-named-account/.cshrc ~/.cshrc In the "tcsh" shell, you can add this to your .cshrc file: set promptchars = '$#' set prompt='%h[%n@%m %/]%# ' In the "bash" shell, you can add one of these to your .bashrc file: PS1="\! \h \w \$ " PS1="\! [\u@\h \w] \$ " There are even more sophisticated things you can do. You could get a book and/or attend the CSUA UNIX presentations to learn more. SunRay UNIX and PC keyboards ---------------------------- The SunRays in the EECS Instructional labs have either UNIX-style or PC-style keyboards. See /share/b/pub/sunray.help for details. EECS Instructional Support 384/386 Cory, 333 Soda inst@eecs.berkeley.edu