[ Pobierz całość w formacie PDF ]
.This could actually bedangerous.Consider the di erence between these two commands:home larry ls -Ftoad froghome larry ls -F frogtoadhome larry rm frog toadhome larryand thishome larry rm frog toadrm: frog is a directoryhome larry ls -Ffroghome larryAs you can see, the di erence of one character made a world of di erence in the outcome of thecommand.It is vital that you check your command lines before hitting return !SLOW4.4.3 A Forklift Can Be Very Handymv -i old-name new-namemv -i le1 le2.leN new-directoryFinally, the other le command you should be aware of is mv.mv looks a lot like cp, except thatit deletes the original le after copying it.It's a lot like using cp and rm together.Let's take a lookat what we can do:home larry cp etc passwd.home larry ls -Fpasswdhome larry mv passwd froghome larry ls -Ffroghome larry mkdir reporthome larry mv frog reporthome larry ls -Freporthome larry ls -F reportfroghome larryAs you can see, mv will rename a le if the second parameter is a le.If the second parameter isa directory, mv will move the le to the new directory, keeping it's shortname the same.4.4.MOVING INFORMATION 35You should be very careful with mv|it doesn't check to see if the le already exists, and willremove any old le in its way.For instance, if I had a le named frog already in my directorySLOWreport, the command mv frog report would delete the le ~ report frog and replace it with~ frog.In fact, there is one way to make rm, cp and mv ask you before deleting les.All three of thesecommands accept the -i option, which makes them query the user before removing any le.If youuse an alias, you can make the shell do rm -i automatically when you type rm.You'll learn moreabout this later in Section 9.1.3 on page 90.36 CHAPTER 4.THE UNIX SHELLChapter 5The X Window SystemThe nice thing about standards is that there are so many of them to choose from.Andrew S.TanenbaumThis chapter only applies to those using the X Window System.If you encounter a screen withmultiply windows, colors, or a cursor that is only movable with your mouse, you are using X.Ifyour screen consists of white characters on a black background, you are not currently using X.Ifyou want to start it up, take a look at Section 5.1.5.1 Starting and Stopping the X Window System5.1.1 Starting XEven if X doesn't start automatically when you login, it is possible to start it from the regular text-mode shell prompt.There are two possible commands that will start X, either startx or xinit.Try startx rst.If the shell complains that no such command is found, try using xinit and see ifX starts.If neither command works, you may not have X installed on your system|consult localdocumentation for your distribution.If the command runs but you are eventually returned to the black screen with the shell prompt,X is installed but not con gured.Consult the documentation that came with your distribution onhow to setup X.5.1.2 Exiting XDepending on how X is con gured, there are two possible ways you might have to exit X.The rstis if your window manager controls whether or not X is running.If it does, you'll have to exit Xusing a menu see Section 5.4.8 on page 43.To display a menu, click a button on the background.3738 CHAPTER 5.THE X WINDOW SYSTEMThe important menu entry should be Exit Window Manager" or Exit X" or some entry con-taining the word Exit".Try to nd that entry there could be more than one menu|try di erentmouse buttons! and choose it.The other method would be for a special xterm to control X.If this is the case, there is probablya window labeled login" or system xterm".To exit from X, move the mouse cursor into thatwindow and type exit".If X was automatically started when you logged in, one of these methods should log you out.Simply login again to return.If you started X manually, these methods should return you to thetext mode prompt.If you wish to logout, type logout at this prompt.5.2 What is The X Window System?The X Window System is a distributed, graphical method of working developed primarily at theMassachusetts Institute of Technology.It has since been passed to a consortium of vendors aptlynamed The X Consortium" and is being maintained by them.The X Window System hereafter abbreviated as X"1 has new versions every few years, calledreleases.As of this writing, the latest revision is X11R6, or release six.The eleven in X11 is o ciallythe version number but there hasn't been a new version in many years, and one is not currentlyplanned.There are two terms when dealing with X that you should be familiar.The client is a X program.For instance, xterm is the client that displays your shell when you log on.The server is a programthat provides services to the client program.For instance, the server draws the window for xtermand communicates with the user.Since the client and the server are two separate programs, it is possible to run the client and theserver on two physically separate machines
[ Pobierz całość w formacie PDF ]