Changes between Version 22 and Version 23 of cypress/BasicLinuxComands


Ignore:
Timestamp:
08/21/18 17:22:16 (6 years ago)
Author:
fuji
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • cypress/BasicLinuxComands

    v22 v23  
    11= Linux Commands =
     2
     3If you have not done yet, '''download Sample files''' by:
     4
     5{{{svn co file:///home/fuji/repos/workshop ./workshop}}}
     6
     7On Cypress.
     8
     9Checkout Sample Files onto local machine, (linux shell)
     10
     11{{{svn co svn+ssh://USERID@cypress1.tulane.edu/home/fuji/repos/workshop ./workshop}}}
    212
    313== Basic Linux Commands ==
     
    2434
    2535{{{
    26 [tulaneID@cypress1 ~]$ cd NextDirectoryDown
    27 [tulaneID@cypress1 NextDirectoryDown]$ pwd
    28 /home/tulaneID/NextDirectoryDown
    29 [tulaneID@cypress1 NextDirectoryDown]$
    30 }}}
    31 
    32 As you can see, !NextDirectoryDown is a ''subdirectory'' of tulaneID. And tulaneID is itself a subdirectory of home, which is a subdirectory of the root directory (/). Thus, the directories form a downward facing tree with all directories stemming from the root directory. You can move one level up in the tree by typing '''cd ..''
    33 
    34 {{{
    35 [tulaneID@cypress1 NextDirectoryDown]$ pwd
    36 /home/tulaneID/NextDirectoryDown
    37 [tulaneID@cypress1 NextDirectoryDown]$ cd ..
     36[tulaneID@cypress1 ~]$ cd workshop
     37[tulaneID@cypress1 workshop]$ pwd
     38/home/tulaneID/workshop
     39[tulaneID@cypress1 workshop]$
     40}}}
     41
     42As you can see, workshop is a ''subdirectory'' of tulaneID. And tulaneID is itself a subdirectory of home, which is a subdirectory of the root directory (/). Thus, the directories form a downward facing tree with all directories stemming from the root directory. You can move one level up in the tree by typing '''cd ..''
     43
     44{{{
     45[tulaneID@cypress1 workshop]$ pwd
     46/home/tulaneID/workshop
     47[tulaneID@cypress1 workshop]$ cd ..
    3848[tulaneID@cypress1 ~]$ pwd
    3949/home/tulaneID
     
    4656[tulaneID@cypress1 ~]$ pwd
    4757/home
    48 [tulaneID@cypress1 ~]$ cd tulaneID/NextDirectoryDown
    49 [tulaneID@cypress1 NextDirectoryDown]$ pwd
    50 /home/tulaneID/NextDirectoryDown
     58[tulaneID@cypress1 ~]$ cd tulaneID/workshop
     59[tulaneID@cypress1 workshop]$ pwd
     60/home/tulaneID/workshop
    5161[tulaneID@cypress1 ~]$ cd /home
    5262[tulaneID@cypress1 ~]$ pwd
     
    6373}}}
    6474
     75
    6576=== ls ===
    6677The '''ls''' command will list files in the current directory.
    6778{{{
    6879[tulaneID@cypress1 ~]$ ls
    69 a.out  code.c  Makefile
     80woekshop
    7081[tulaneID@cypress1 ~]$
    7182}}}
     
    7384If you would like to see if a directory contains a specific file, you can pass the directory path and file name to '''ls''' as an argument
    7485{{{
    75 [tulaneID@cypress1 ~]$ ls a.out
    76 a.out
     86[tulaneID@cypress1 ~]$ ls workshop
     87BlasLapack  Eigen3        HeatMass    JobArray1  JobDependencies  MPI     PETSc  precision  Python  ScaLapack  SimpleExample  TestCodes  VTK
     88CUDA        FlowInCavity  hybridTest  JobArray2  Matlab           OpenMP  PI     PSE        R       SerialJob  SLU40          uBLAS
    7789[tulaneID@cypress1 ~]$
    7890}}}
     
    8092Setting the ''-l'' flag will display files along with their permissions and ownership.
    8193{{{
    82 [tulaneID@cypress1 ~]$ ls -l
    83 total 0
    84 -rw-r--r-- 1 tulaneID MyGroup 0 Aug 14 10:57 a.out
    85 -rw-r--r-- 1 tulaneID MyGroup 0 Aug 14 10:57 code.c
    86 -rw-r--r-- 1 tulaneID MyGroup 0 Aug 14 10:57 Makefile
     94[tulaneID@cypress1 ~]$ ls -l workshop
     95total 100
     96drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 BlasLapack
     97drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 CUDA
     98drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 Eigen3
     99drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 FlowInCavity
     100drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 HeatMass
     101drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 hybridTest
     102drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 14:23 JobArray1
     103drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 14:42 JobArray2
     104drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 15:20 JobDependencies
     105drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 Matlab
     106drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 MPI
     107drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 OpenMP
     108drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 PETSc
     109drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 PI
     110drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 precision
     111drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 PSE
     112drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:15 Python
     113drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 R
     114drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 ScaLapack
     115drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:45 SerialJob
     116drwxr-xr-x 9 fuji hpcstaff 4096 Aug 21 13:06 SimpleExample
     117drwxr-xr-x 5 fuji hpcstaff 4096 Aug 21 13:06 SLU40
     118drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 TestCodes
     119drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 uBLAS
     120drwxr-xr-x 3 fuji hpcstaff 4096 Aug 21 13:06 VTK
    87121[tulaneID@cypress1 ~]$
    88122}}}
     
    103137Remove files and directories. CAUTION: THERE IS NO UNDOING THIS COMMAND.
    104138{{{
    105 [tulaneID@cypress1 ~]$ rm testfile
     139[tulaneID@cypress1 ~]$ rm workshop
    106140}}}
    107141If you would like to remove a directory and all of its contents use the following command:
    108142{{{
    109 [tulaneID@cypress1 ~]$ rm -ri testdir
    110 rm: descend into directory `testdir'? y
    111 rm: remove regular empty file `testdir/Makefile'? y
    112 rm: remove regular empty file `testdir/code.c'? y
    113 rm: remove regular empty file `testdir/a.out'? y
    114 rm: remove directory `testdir'? y
    115 [tulaneID@cypress1 ~]$
    116 }}}
     143[tulaneID@cypress1 ~]$ rm -ri workshop
     144rm: descend into directory `workshop'? y
     145rm: descend into directory `workshop/PI'? y
     146rm: descend into directory `workshop/PI'? n
     147rm: descend into directory `workshop/uBLAS'? ^C
     148[tulaneID@cypress1 ~]$
     149}}}
     150ctrl+c to exit.
     151
    117152The ''r'' flag specifies to remove files/directories recursively. ''i'' specifies to prompt before deleting each file.
    118153
    119154If you are confident with the command line and your understanding of file locations you can use the ''f'' flag instead of ''i'' to force deletion of all files without prompting:
    120155{{{
    121 [tulaneID@cypress1 ~]$ rm -rf testdir
    122 [tulaneID@cypress1 ~]$ ls testdir
    123 ls: cannot access testdir: No such file or directory
    124 [tulaneID@cypress1 ~]$
    125 }}}
     156[tulaneID@cypress1 ~]$ rm -rf workshop
     157[tulaneID@cypress1 ~]$ ls workshop
     158ls: cannot access workshop: No such file or directory
     159[tulaneID@cypress1 ~]$
     160}}}
     161
     162Do this again to download sample files:
     163
     164{{{svn co file:///home/fuji/repos/workshop ./workshop}}}
    126165
    127166== rmdir ==