Wątki

[ Pobierz całość w formacie PDF ]
.For example, chmod -R 644 /tmp/test turns off execute permission for the /tmp/test directory, thenfails to change any files or directories below that point.Moving, copying, and deleting filesCommands for moving, copying, and deleting files are fairly straightforward.To change the location of a file,use the mv command.To copy a file from one location to another, use the cp command.To remove a file, usethe rm command.Here are some examples:$ mv abc def$ mv abc ~$ cp abc def$ cp abc ~$ rm abc$ rm *Of the two move (mv) commands, the first moves the file abc to the file def in the same directory (essentiallyrenaming it), whereas the second moves the file abc to your home directory (~).The first copy command (cp)copies abc to the file def, whereas the second copies abc to you home directory (~).The first removecommand (rm) deletes the abc file, whereas the second removes all the files in the current directory.Note For the root user, the mv, cp, and rm commands are aliased to each be run with the -i option.Thiscauses a prompt to appear asking you to confirm each move, copy, and removal, one file at a time.Thisis done to prevent the root user from messing up a large group of files by mistake.Using the vi Text EditorIt s almost impossible to use Red Hat Linux for any period of time and not need to use a text editor.If you areusing a GUI, you can run xedit, which has a fairly intuitive interface for editing text.Most Red Hat Linuxshell users will use either the vi or emacs commands to edit plain-text files.The advantage of using vi or emacs, instead of a graphical editor, is that you can use it from a Terminal window, a character terminal, or acharacter-based connection over a network (using telnet or ssh, for example).No GUI is required.This section provides a brief tutorial of the vi text editor.Any time in this book that I suggest you manuallyedit a configuration file, you can use vi to do that editing (from any shell prompt).The vi editor is difficult tolearn at first.But when you know it, you will be able to edit and move files around quickly and efficiently.Your fingers never have to leave the keyboard to pick up a mouse or hit a function key.Starting with viMost often, you start vi to open a particular file.For example, to open a file called /tmp/test, type thefollowing command:$ vi /tmp/testIf this is a new file, you should see something similar to the following:~~~~~"/tmp/test" [New File]The box at the top represents where your cursor is.The bottom line keeps you informed about what is goingon with your editing (here you just opened a new file).In between, there are tildes (~) as filler because there isno text in the file yet.Now here s the intimidating part: there are no hints, menus, or icons to tell you what todo.On top of that, you can t just start typing.If you do, the computer is likely to beep at you.The first things you need to know are the different operating modes.The vi editor operates in either commandmode or input mode.When you start vi, you are in command mode.Before you can add or change text in thefile, you have to type a command to tell vi what you want to do.A command consists of one or two letters andan optional number.To get into input mode, you need to type an input command.To start out, type either ofthe following input commands:"a  Add.After you type a, you can input text that starts to the right of the cursor."i  Insert.After you type i, you can input text that starts to the left of the cursor.Type a few words and press Enter.Repeat that a few times until you have a few lines of text.When you aredone typing, press Esc.You are now back in command mode.Remember the Esc key! It always places youback into command mode.Now that you have a file with some text in it, try moving around within that textwith the following keys or letters:"Arrow keys  Use the arrow keys to move up, down, left, or right in the file one character at a time.To move left and right you can also use Backspace and the spacebar, respectively.If you prefer tokeep your fingers on the keyboard, use h (left), l (right), j (down), or k (up) to move the cursor."w  Moves the cursor to the beginning of the next word." b  Moves the cursor to the beginning of the previous word."0 (zero)  Moves the cursor to the beginning of the current line."$  Moves the cursor to the end of the current line."H  Moves the cursor to the upper-left corner of the screen (first line on the screen)."M  Moves the cursor to the first character of the middle line on the screen."L  Moves the cursor to the lower-left corner of the screen (last line on the screen).Now that you know how to input text and move around in text, the only other editing you need to know ishow to delete text.Here are a few vi commands for deleting text:"x  Deletes the character under the cursor."X  Deletes the character directly before the cursor."dw  Deletes from the current character to the end of the current word."d$  Deletes from the current character to the end of the current line."d0  Deletes from the previous character to the beginning of the current line [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • mikr.xlx.pl
  • Powered by MyScript