Changes between Version 3 and Version 4 of cypress/BasicLinuxComands
- Timestamp:
- 05/14/15 12:08:29 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
cypress/BasicLinuxComands
v3 v4 73 73 74 74 In the example below file1 already exists, and file2 will become the copy. 75 75 {{{ 76 76 [tulaneID@cypress1 ~]$ cp file1 file2 77 }}} 77 78 To copy a directory and all of its contents: 78 79 {{{ 79 80 [tulaneID@cypress1 ~]$ cp -r dir1 dir2 80 mv 81 }}} 82 83 === mv === 81 84 Move a file to a new location. 82 85 {{{ 83 86 [tulaneID@cypress1 ~]$ mv file1 file2 84 87 [tulaneID@cypress1 ~]$ ls file1 … … 86 89 [tulaneID@cypress1 ~]$ ls file2 87 90 file2 88 Unlike cp, the mv command does not create a second instance of the file or directory. 89 90 quota 91 }}} 92 Unlike '''cp''', the '''mv''' command does not create a second instance of the file or directory. 93 94 === quota === 91 95 Display disk quotas. 92 96 93 The -s flag 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. 94 95 user@sphynx>quota -s 96 Disk quotas for user wcurry (uid 65098): 97 Filesystem blocks quota limit grace files quota limit grace 98 /scratch03 86978M 1024G 2048G 180k 0 391m 99 /u01 2723M 40000M 40050M 19136 0 0 100 cat 101 Print the entire contents of a file. 102 97 The '-s' flag 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. 98 {{{ 99 [tulaneID@cypress1 ~]$quota -s 100 Disk quotas for user tulaneID (uid 12345): 101 Filesystem blocks quota limit grace files quota limit grace 102 master.10ge.cluster:/home 103 6459M 10000M 10000M 23260 250k 250k 104 master.10ge.cluster:/share/apps 105 6459M 10000M 10000M 23260 250k 250k 106 }}} 107 108 === cat === 109 Print the entire contents of a file (short for conCATenate). 110 {{{ 103 111 [tulaneID@cypress1 ~]$ cat daysofweek.txt 104 112 monday … … 109 117 saturday 110 118 sunday 111 more 112 more is like cat, except it prints the file one page at a time. The spacebar is used to continue on to the next page. 113 114 grep 115 Find text in a file. grep will return every line in the file that matches your search term. 116 119 }}} 120 121 === more === 122 '''more''' is like '''cat''', except it prints the file one page at a time. The spacebar is used to continue on to the next page. 123 124 === grep === 125 Find text in a file. '''grep''' will return every line in the file that matches your search term. 126 {{{ 117 127 [tulaneID@cypress1 ~]$ cat animals 118 128 dog … … 126 136 [tulaneID@cypress1 ~]$ grep dog animals 127 137 dog 128 Use the -v flag to print out every line excluding those containing the search term. Notice that "dog" (lowercase) is missing from the results. 129 138 }}} 139 Use the ''-v'' flag to print out every line excluding those containing the search term. Notice that "dog" (lowercase) is missing from the results. 140 {{{ 130 141 [tulaneID@cypress1 ~]$ grep -v dog animals 131 142 Dog … … 135 146 bullfrog 136 147 Little Doggie 137 The -i flag will search without case-sensitivity. 138 148 }}} 149 The ''-i'' flag will search without case-sensitivity. 150 {{{ 139 151 [tulaneID@cypress1 ~]$ grep -i dog animals 140 152 dog … … 142 154 DOG 143 155 Little Doggie 144 The -i and -v flag can be combined to exclude all lines containing the search term regardless of capitalization. 145 156 }}} 157 The ''-i'' and ''-v'' flag can be combined to exclude all lines containing the search term regardless of capitalization. 158 {{{ 146 159 [tulaneID@cypress1 ~]$ grep -iv dog animals 147 160 cat 148 161 Racoon 149 162 bullfrog 150 sed 151 sed is a powerful text stream editor. There are many uses of this program, but the most common is its search and replace function. Combined with regular expressions, this command can be used to seek out complex strings in your code and replace them with modifications. Please visit Sed - An Introduction and Tutorial for more information. 152 163 }}} 164 165 === sed === 166 '''sed''' is a powerful text stream editor. There are many uses of this program, but the most common is its search and replace function. Combined with regular expressions, this command can be used to seek out complex strings in your code and replace them with modifications. Please visit [[http://www.grymoire.com/Unix/Sed.html|Sed - An Introduction and Tutorial]] for more information. 167 {{{ 153 168 [tulaneID@cypress1 ~]$ cat animals 154 169 dog … … 168 183 bullfrog 169 184 Little Doggie 170 awk 171 awk is a programming language used to modify files. One common use of awk is printing specific columns of a text stream or file. 172 185 }}} 186 187 === awk === 188 '''awk''' is a programming language used to modify files. One common use of '''awk''' is printing specific columns of a text stream or file. 189 {{{ 173 190 [tulaneID@cypress1 ~]$ cat sample.data 174 191 0.3 0.22 1.8 … … 180 197 3.1 3.0 181 198 0.2 3.2 182 The above command printed out the 1st and 3rd columns of the sample.data file. 183 184 For more information on awk please visit Awk - A Tutorial and Introduction.185 186 tail 199 }}} 200 The above command printed out the 1st and 3rd columns of the '''sample.data''' file. 201 For more information on awk please visit [[http://www.grymoire.com/Unix/Awk.html|Awk - A Tutorial and Introduction]]. 202 203 === tail === 187 204 Displays lines from the end of a file. Useful for viewing recent results in an output file. 188 205 {{{ 189 206 [tulaneID@cypress1 ~]$ cat animals 190 207 dog … … 200 217 bullfrog 201 218 Little Doggie 202 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. 203 204 head 205 Head is much like tail, except it prints from the top of a file. 219 }}} 220 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. 221 222 === head === 223 '''head''' is much like '''tail''', except it prints from the top of a file.