“Dilbert” by, Scott Adams, Sep 30, 1994. Basics of the Unix/Linux Environment Unix Philosophy and Account Information Unix Philosophy According to Doug McIlroy Make each program do one thing well. So, to do a new job, build afresh rather than complicate old programs by adding new features (otherwise known as “bells and whistles”). Machine shop vs. appliance (gives you the tools and you to make appliance) implications Typical question from you all: Can UNIX do this? Typical answer from a professor: NO, but YOU can write a program! Unix enthusiasts think this is the answer the average user wants to hear! Unix put lots of single minded programs in a row (with pipes “|” ) to do what you need. Don’t use temporary/intermediate files – use pipe In other words, Unix prefers to take input from previous program and send output to next program Write programs that do one thing and do it well. (lean and mean) Write programs to work together. (pipes) Accessing unix from Sun lab Sit down If the screen is dark – hit any key (the shift key is the “safest” as it does not actually send anything to the computer) or move the mouse to “wake it up”. Type your CERI/UoM user id (uuid) Type your CERI unix password *Note that unix machines are case sensitive The % is the “prompt” from the shell that says it is ready read input. There is also usually a flashing cursor after the prompt. Commands we will enter are shown in italics. <CR> is Carriage Return/Enter. This activity occurs in the terminal window User ID User ID: usually a short derivative of your name and the beginning of your email. Your CERI and UoM user ids are the same User ID’s on the UM system can only be a maximum of 8 characters due to the limitations of early computers. Unix is full of such anachronisms. User ID’s are formed using an algorithm. Take first initial (and maybe middle) and full last name, if that is more than 8 characters, start removing vowels from the back, if still longer than 8 characters, start removing consonants from the back. User Passwords Password: a complicated combination of upper and lower case characters, symbols, and numbers that allows access to the account. Your CERI Unix password is unique to the Sun system Your UoM Outlook email, Spectrum, Tiger labs, and CERI PC lab password is the same because it is all accessing your primary UoM account. If you need/use the non-Sun systems (Unix machines in the GPS lab, a faculty member’s Apple, etc.) you will have a unique username/password for each of them. Passwords Do not share your password!!!! Do not leave your password sitting around on a postit note. Do not email your password. If you forget your password, you have to visit the system administrator and (humbly) ask for a new one. There is no way for anyone (except hackers) to figure it out. Changing your password Unix passwords can be easily changed using the passwd command %passwd for CERI password changes %passwd –r nis Changing password for hdeshon Old password: type in old password New password: type in new password Re-type new password: type in new password again What not to use for your password: - Your name, address, phone number, or anything that is common knowledge, or can be easily guessed, about you. - Common words. Password guessing programs don’t get tired and can try 1000’s of permutations of passwords based on the above. What to use for your password: - Something you will not forget. - Mix in numbers and special characters (1, 2, 3 , !, @, #, $, %, etc.). - Should be at least 6 characters long (some systems require longer ones). - (don’t use items from “do not use” list with “1” substituted for “i”, “0” substituted or “o”, etc., the password guessers will try these.) Accessing unix via SSH SSH: secure shell login is the preferred way to remotely log on to the CERI unix system; do not use telnet SSH is secure, easy and with X-tunneling enabled, you can view graphics just as if you were sitting at the remote machine Machines at CERI accept ssh access from all local Internet providers and other CERI and UoM addresses If you want access from out of town, you will have to send Bob Debula the IP address of the out-ofMemphis computer Accessing Suns via SSH Mac or Sun machine 1: open an X11 or Terminal window 2a: mac% ssh -Y hdeshon@enigma.ceri.memphis.edu 2b: sun% ssh -X hdeshon@enigma.ceri.memphis.edu 3: type CERI unix password at prompt PC 1: open the SSH application from the desktop or applications folder 2: enable X11 tunneling via the Settings menu (only do once) 3: click on Quick Connect 4: type in CERI host name and uuid, then password at prompt Accessing Suns via Exceed The PCs in the long building have a special terminal emulator program, called Exceed, for remote ssh access to the unix machines. Once you choose a unix machine via Exceed, the PC screen looks like the unix terminal and regular unix log-in applies Directions for Exceed setup can be found at http://www.ceri.memphis.edu/people/mwithers/CERIComputing/Exceed/sshexceed. html Directories Hierarchical file system which looks like upside down tree Starts at top with “/”, called “root”. Uses “/” to separate directories (known as folders on Apple/Windows) Top Level Directories Home directories Home Directory /gaia/home/hdeshon Subdirectories bin/ tomoDD* Projects/ db2hdd* SUMATRA/ Up the directory structure or moving backward through the path /gaia/home/hdeshon bin/ tomoDD* Projects/ db2hdd* Down the directory structure or moving forward in the path SUMATRA/ Moving around directories pwd: prints path name of current directory % pwd %/gaia/home/hdeshon [this is what would appear if I had just logged on] cd: change directory % cd Projects % cd automatically cd into your home directory % cd ~/bin cd into your-home-directory/bin . and .. The “.” signifies the current or working directory % cd . No change in location The “..” signifies the directory directly above you (up) in the directory structure (tree) % cd .. cd back one directory % cd ../../scratch/200GB/hdeshon cd back two directories then forward three into scratch subdirectory hdeshon Listing directory contents ls: lists files and subdirectories of the specified path % ls /gaia/home/hdeshon bin src suma.new.res % ls list everything in the current directory % ls ~/bin list your-home-directory/bin Flags & manual pages Almost all unix commands have a list of flags that can be specified to modify the default behavior % ls –F -F in this case is one flag option for ls The potential flags are listed within each command’s manual page To view a manual page, use the man command % man pwd PWD(1) BSD General Commands Manual PWD(1) NAME pwd -- return working directory name SYNOPSIS pwd [-LP] DESCRIPTION pwd writes the absolute pathname of the current working directory to the standard output. The pwd utility exits 0 on success, and >0 if an error occurs. The following options are available: -L Print the logical path to the current working directory, as defined by the shell in the environment variable PWD. -P Print the physical path to the current working directory, with symbolic links in the path resolved. This is the default. ls continued % ls -F list directories with ‘/’ & executables with ‘*’ % ls –alF list entries beginning with ‘.’ & show in long format -rwx------ 1 hdeshon hdeshon 1201 Jul 10 15:03 .tcshrc* drwx------ 1 hdeshon hdeshon 16384 Aug 1 13:50 bin/ -rw------- 1 hdeshon hdeshon 186668405 Jul 31 2007 suma.new.res From my mac…. %cd /Applications %ls -F Absoft10/ Adobe Acrobat 8 Professional/ Macs have many directories with spaces in the name Spaces on Unix are somewhat of a problem as Unix does not handle spaces and special characters well because they mean something special in the shell. !@#$%^&*()_+|?><`[]{}\’”:; The problem with spaces is that the command interpreter of the shell parses (breaks) the command line up into tokens (individual items) based on the spaces. So our file name gets broken into 4 small distinct character strings (“Adobe”, “SVG”, “3.0”, and “Installer”) which causes confusion. So we have to “protect” the spaces from the interpreter. This is done with quotes. We refer to this file using %ls “Adobe SVG 3.0 Installer” or %ls ‘Adobe SVG 3.0 Installer‘