Page 196 - DCAP602_NETWORK_OPERATING_SYSTEMS_I
P. 196

Network Operating Systems-I




                    notes          Examples of mv and its options include:

                                        command                                results
                                   mv file1 file2    If file2 does not exist, then file1 is renamed file2. If file2 exists, its contents are
                                                     replaced with the contents of file1.
                                   mv -i file1 file2  Like above however, since the “-i” (interactive) option is specified, if file2 exists,
                                                     the user is prompted before it is overwritten with the contents of file1.
                                   mv file1 file2 file3 dir1  The files file1, file2, file3 are moved to directory dir1. dir1 must exist or mv will
                                                     exit with an error.
                                   mv dir1 dir2      If dir2 does not exist, then dir1 is renamed dir2. If dir2 exists, the directory dir1
                                                     is created within directory dir2.

                                   rm

                                   The rm command deletes (removes) files and directories.
                                   $ rm file
                                   It can also be used to delete a directory:

                                   $ rm -r directory
                                   Examples of rm and its options include:

                                     command                                results
                                   rm file1 file2  Delete file1 and file2.
                                   rm -i file1 file2  Like above however, since the “-i” (interactive) option is specified, the user is prompted
                                                before each file is deleted.
                                   rm -r dir1 dir2  Directories dir1 and dir2 are deleted along with all of their contents.
                                   Be careful with rm. Linux does not have an undelete command. Once you delete a file with
                                   rm, it’s gone. You can inflict terrific damage on your system with rm if you are not careful,
                                   particularly with wildcards.

                                   Before you use rm with wildcards, try this helpful trick: construct your command using ls instead.
                                   By doing this, you can see the effect of your wildcards before you delete files. After you have
                                   tested your command with ls, recall the command with the up-arrow key and then substitute rm
                                   for ls in the command.

                                   mkdir

                                   The mkdir command is used to create directories. To use it, you simply type:
                                   $ mkdir directory




                                      Note     Wildcards allow you to select filenames based on patterns of characters.


                                   process manipulation

                                   As with any multitasking operating system, Linux executes multiple, simultaneous processes.
                                   Well, they appear simultaneous anyway. Actually, a single processor computer can only execute
                                   one process at time but the Linux kernel manages to give each process its turn at the processor
                                   and each appears to be running at the same time.





          190                              LoveLy professionaL university
   191   192   193   194   195   196   197   198   199   200   201