290 likes | 428 Views
Thomas Krichel 2006-12 -10. LIS651 lecture 5 direct use of wotan. communication with wotan. For file editing and manipulation, we use putty. For file transfer, we use winscp. Both are available on the web. The protocol is ssh, the secure shell, based public-key cryptography.
E N D
Thomas Krichel 2006-12-10 LIS651 lecture 5direct use of wotan
communication with wotan • For file editing and manipulation, we use putty. • For file transfer, we use winscp. • Both are available on the web. • The protocol is ssh, the secure shell, based public-key cryptography.
installing putty • Go to your favorite search engine to search for putty. • If you have administrator rights install the installer version. • Since you have already installed winscp, you should have no further problems.
putty options • In the window/translation choose UTF-8, always. • Find out what the size of your screen is of screen that your are using for the font that you are using, and save that in your session. • For wotan, the port is 22, ssh. • You can choose to disable the annoying bell.
issuing commands • While you are logged in, you talk to the computer by issuing commands. • Your commands are read by command line interpreter. • The command line interpreter is called a shell. • You are using the Bourne Again Shell, bash.
bash features • bash allows to browse the command history with the up/down arrow keys • bash allows to edit commands with the left/right arrow keys • “exit” is the command to leave the shell.
files, directories and links • Files are continuous chunks data on disks that are required for software applications. • Directories are files that contain other files. Microsoft calls them folders. • In UNIX, the directory separator is “/” • The top directory is “/” on its own.
home directory • When you first log in to wotan you are placed in your home directory /home/username • “cd” is the command that gets you back to the home directory. • The home directory is also abbreviated as “~“ • cd ~user gets you to the home of user user. • “cd ~” does what?
~/public_html • Is your web directory. I created it with “mkdir public_html” in your home directory. • The web server on wotan will map requests to http://wotan.liu.edu/~user to show the file ~user/public_html/index.html • The web server will map requests to http://wotan.liu.edu/~user/file to show the file ~user/public_html/file • The server will do this by virtue of a configuration option.
changing directory, listing files • cd directory changes into the directory directory • the current directory is “.” • its parent directory is “..” • ls lists files
users and groups • “root” is the user name of the superuser. • The superuser has all privileges. • There are other physical users, i.e. persons using the machine • There are users that are virtual, usually created to run a daemon. For example, the web sever in run by a user www-data. • Arbitrary users can be put together in groups.
permission model • Permission of files are given • to the owner of the file • to the the group of the file • and to the rest of the world • A group is a grouping of users. Unix allows to define any number of groups and make users a member of it. • The rest of the world are all other users who have access to the system. That includes www-data!
listing files • “ls” lists files • “ls -l” make a long listing. It contains • elementary type and permissions (see next slide) • owner • group • size • date • name
first element in ls -l • Type indicator • d means directory • l means link • - means ordinary file • 3 letters for permission of owner • 3 letters for permission of group • 3 letters for permission of rest of the world • r means read, w means write, x means execute • Directories need to be executable to get in them…
change permission: chmod • usage: chmod permission file • file is a file • permission is three numbers, for owner, group and rest of the world. • Each number is sum of elementary numbers • 4 is read • 2 is write • 1 is execute • 0 means no permission. • Example: chmod 764 file
general structure of commands • commandname –flag --option • Where commandname is a name of a command • flag can be a letter • Several letters set several flags at the same time • An option can also be expressed with - - and a word, this is more user-friendly than flags.
example command: ls • ls lists files • ls -l makes a long listing • ls -a lists all files, not only regular files but some hidden files as well • all files that start with a dot are hidden • ls -la lists all files is long listing • ls --all is the same as ls -a. --all is known as a long listing.
copying and removing files • cp file copyfile copies file file to file copyfile. If copyfile is a directory, it copies into the directory. • mv file movedfile moves file file to file movedfile. If movedfile is a directory, it moves into the directory. • rm file removes file,there is no recycling bin!!
directories and files • mkdir directory makes a directory • rmdir directory removes an empty directory • rm -r directory removes a directory and all its files • more file • Pages contents of file, no way back • less file • Pages contents of file, “u” to go back, “q” to quit
soft links • A link is a file that contain the address of another file. Microsoft call it a shortcut. • A soft link can be created with the command • where file is a file that is already there and link_to_file is the link.
file transfer • You can use winscp to upload and download files to wotan. • If uploaded files in the web directory remain invisible, that is most likely a problem with permission. Refer back to permissions. • chmod 644 * will put it right for the files • chmod 755 . (yes with a dot) will put it right for the current directory • * is a wildcard for all files. • rm -r * is a command to avoid.
editing • There are a plethora of editors available. • For the neophyte, nano works best. • nano file edits the file file. • nano -w switches off line wrapping. • nano shows the commands available at the bottom of the screen. Note that ^letter, where letter is a letter, means pressing CONTROL and the letter letter at the same time.
emacs • This is another editor that is incredibly featureful and complex. • Written by Richard M. Stallman, of GNU and GPL fame. • Get an emacs cheat sheet of the web before you start it. Or look at next slide.
emacs commands (here ^ stands for the control characher) • ^x^s saves buffer • ^x^c exits emacs • ^g escapes out of a troublesome situation • control+space sets the mark • ^w removes until the mark (cut) • ^y pastes
common emacs/bash commands • ^k kills until the end of the line or removes empty line • ^y yank what has been killed (paste) • ^a get to the beginning of the line • ^e get to the end of the line
emacs modes • Just like people get into different moods, emacs gets into different modes. • One mode that will split your pants is the PHP mode. • “emacs file.php” to edit the file file in PHP mode. • Then look how emacs checks for completion of parenthesis, braces, brackets, and the ; and use the tab character to indent.
copy and paste • Putty allows to copy and paste text between windows and wotan. • On the windows machine, it uses the windows approach to copy and paste • On wotan machine, • you copy by highlighting with the mouse’ left button • you paste using the middle button • if you don't have a middle button, use left and right together
running mySQL • You can run mySQL in command line mode in wotan. Type mysql -u user -p • You will then be prompted for your password. The username and password are your mySQL user name and mySQL password, not your wotan user name and wotan password. • Don’t forget the semicolon after each command!
Thank you for your attention! Please switch off machines b4 leaving! http://openlib.org/home/krichel