Changes between Version 9 and Version 10 of cypress/BasicLinuxComands
- Timestamp:
- 08/19/15 06:28:54 (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
cypress/BasicLinuxComands
v9 v10 109 109 }}} 110 110 111 == rmdir == 112 Removes directories. The '''rmdir''' is a safer approach than using '''rm -r''' as it will only act on empty directories. 113 114 {{{ 115 [tulaneID@cypress1 ~]$ ls NextDirectoryDown/ 116 file.txt 117 [tulaneID@cypress1 ~]$ rmdir NextDirectoryDown/ 118 rmdir: failed to remove `NextDirectoryDown/': Directory not empty 119 [tulaneID@cypress1 ~]$ rm NextDirectoryDown/file.txt 120 [tulaneID@cypress1 ~]$ rmdir NextDirectoryDown/ 121 [tulaneID@cypress1 ~]$ ls 122 [tulaneID@cypress1 ~]$ 123 124 }}} 125 111 126 === cp === 112 127 Copy file to new location. 113 128 114 In the example below file1 already exists, and file2 will become the copy. 115 {{{ 116 [tulaneID@cypress1 ~]$ cp file1 file2 117 }}} 118 To copy a directory and all of its contents: 119 {{{ 120 [tulaneID@cypress1 ~]$ cp -r dir1 dir2 121 }}} 122 129 In the example below sourcefile already exists, and destinationfile may or may not exist and will become a copy of sourcefile. 130 {{{ 131 [tulaneID@cypress1 ~]$ cp sourcefile destinationfile 132 }}} 133 To copy a directory and all of its contents we use the recursive flag '''-r''': 134 {{{ 135 [tulaneID@cypress1 ~]$ cp -r sourcedir destinationdir 136 }}} 137 138 Take note of the order here: source first, destination second. This is the standard order across most *nix commands. 123 139 === mv === 124 140 Move a file to a new location.