Changes between Version 32 and Version 33 of cypress/BasicLinuxComands
- Timestamp:
- 03/20/20 12:11:52 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
cypress/BasicLinuxComands
v32 v33 45 45 }}} 46 46 47 And you can navigate using either relative or absolute paths. That is, you can enter directory paths relative to your current location, or you can entire the entire path starting with the root directory. 47 === Note === 48 You can specify directories and file names as arguments for '''cd''' and most other *nix commands as needed using either relative paths (without initial "/") or absolute paths (beginning with "/"). 49 When you specify directories and file names using relative paths, those paths are always interpreted relative to (or starting from) your current working directory (the result of '''pwd'''), whereas absolute paths are always interpreted independently of your current working directory (or starting from root directory /). 48 50 49 51 {{{ … … 58 60 Lastly, if you ever get lost you can use the tilde (~ - or simply **cd** with no argument!) to return to your HOME directory. 59 61 {{{ 60 [tulaneID@cypress1 home]$ cd ~62 [tulaneID@cypress1 home]$ cd 61 63 [tulaneID@cypress1 ~]$ pwd 62 64 /home/tulaneID … … 81 83 }}} 82 84 83 Setting the {{{-l}}} flag will display files along with their permissions and ownership.85 Using the {{{-l}}} option will display files using the long listing format, including their permissions, ownership, size, and last date modified. 84 86 {{{ 85 87 [tulaneID@cypress1 ~]$ ls -l hpc-workshop … … 142 144 Use Ctrl+c to exit the prompts. 143 145 144 The {{{-r}}} flagspecifies to remove files/directories recursively. {{{-i}}} specifies to prompt before deleting each file.145 146 If you are confident with the command line and your understanding of file locations you can use the {{{-f}}} flaginstead of {{{-i}}} to force deletion of all files without prompting:146 The {{{-r}}} option specifies to remove files/directories recursively. {{{-i}}} specifies to prompt before deleting each file. 147 148 If you are confident with the command line and your understanding of file locations you can use the {{{-f}}} option instead of {{{-i}}} to force deletion of all files without prompting: 147 149 {{{ 148 150 [tulaneID@cypress1 ~]$ rm -rf hpc-workshop … … 180 182 [tulaneID@cypress1 ~]$ cp sourcefile destinationfile 181 183 }}} 182 To copy a directory and all of its contents we use the recursive flag{{{-r}}}:184 To copy a directory and all of its contents we use the recursive option {{{-r}}}: 183 185 {{{ 184 186 [tulaneID@cypress1 ~]$ cp -r sourcedir destinationdir … … 199 201 200 202 === Note === 201 Here and in the following, in order to try out the commands shown, you may copy the files needed from '''/lustre/project/workshop'''to your home directory.202 203 {{{ 204 tulaneID@cypress1 ~]$ cp /lustre/project/workshop/textfiles/daysofweek.txt .205 tulaneID@cypress1 ~]$ cp /lustre/project/workshop/animals .203 Here and in the following, in order to try out the commands shown, you may copy the files needed from your downloaded '''hpc-workshop''' directory to your home directory. 204 205 {{{ 206 tulaneID@cypress1 ~]$ cp hpc-workshop/textfiles/daysofweek.txt . 207 tulaneID@cypress1 ~]$ cp hpc-workshop/animals . 206 208 tulaneID@cypress1 ~]$ ls 207 209 animals daysofweek.txt hpc-workshop … … 241 243 [tulaneID@cypress1 ~]$ 242 244 }}} 243 The {{{-f}}} flag can be used to tail a file interactively. New additions to the end of the file will be printed to your screen.245 The {{{-f}}} option can be used to tail a file interactively. New additions to the end of the file will be printed to your screen as they occur. 244 246 245 247 === head === … … 293 295 }}} 294 296 295 Additionally, the behavior of the '''ls''' command can be modified by the addition of option flags. By default '''ls''' does not list any "hidden" files and subdirectories. To display all files and subdirectories one must add the {{{-a}}} flag.297 Additionally, the behavior of the '''ls''' command can be modified by the use of options. By default '''ls''' does not list any "hidden" files and subdirectories. To display all files and subdirectories one must add the {{{-a}}} option. 296 298 297 299 {{{ … … 325 327 Display disk quotas. 326 328 327 The {{{-s}}} flagtranslates the output into a readable format. If your blocks column is equal to or greater than the quota column, you have exceeded your available disk space.329 The {{{-s}}} option translates the output into a readable format. If your blocks column is equal to or greater than the quota column, you have exceeded your available disk space. 328 330 {{{ 329 331 [tulaneID@cypress1 ~]$quota -s … … 354 356 [tulaneID@cypress1 ~]$ 355 357 }}} 356 Use the {{{-v}}} flagto print out every line excluding those containing the search term. Notice that "dog" (lowercase) is missing from the results.358 Use the {{{-v}}} option to print out every line excluding those containing the search term. Notice that "dog" (lowercase) is missing from the results. 357 359 {{{ 358 360 [tulaneID@cypress1 ~]$ grep -v dog animals … … 365 367 [tulaneID@cypress1 ~]$ 366 368 }}} 367 The {{{-i}}} flagwill search without case-sensitivity.369 The {{{-i}}} option will search without case-sensitivity. 368 370 {{{ 369 371 [tulaneID@cypress1 ~]$ grep -i dog animals … … 374 376 [tulaneID@cypress1 ~]$ 375 377 }}} 376 The {{{-i}}} and {{{-v}}} flags can be combined to exclude all lines containing the search term regardless of capitalization.378 The {{{-i}}} and {{{-v}}} options can be combined to exclude all lines containing the search term regardless of capitalization. 377 379 {{{ 378 380 [tulaneID@cypress1 ~]$ grep -iv dog animals … … 386 388 Searches for files in a directory hierarchy. The '''find''' takes a directory as an argument and will search in that directory and all of it's subdirectories for files that match the search criteria. If no directory is specified, the current directory is used. 387 389 388 You can search for a file by name using the {{{-name}}} flagas your search criteria390 You can search for a file by name using the {{{-name}}} option with its accompanying argument as your search criteria 389 391 {{{ 390 392 [tulaneID@cypress1 ~]$ find /home/tulaneID/ -name file1.txt