Bash It Up ENGR 1213 Some helpful hints for the bash shell follow. 0.script xxxx - captures and extire bash session which you can review later in a file named xxxx 1.pwd - displays current dir evan@ELEMLEY-LINUX:~/Desktop/evdoc/porous_media$ pwd /home/evan/Desktop/evdoc/porous_media 2.ls - lists things evan@ELEMLEY-LINUX:~/Desktop/evolver$ ls -Alt total 4276 drwxr-xr-x 2 evan evan 4096 2008-02-26 14:14 src -rw-r--r-- 1 evan evan 2901023 2008-02-26 14:10 evolver-2.30c.tar.gz -rw-r--r-- 1 evan evan 1437981 2008-01-04 06:54 manual230.pdf drwxr-xr-x 2 evan evan 4096 2008-01-03 13:11 doc -rw-r--r-- 1 evan evan 5495 2008-01-03 11:54 README drwxr-xr-x 2 evan evan 4096 2008-01-03 11:38 fe -rw-r--r-- 1 evan evan 3581 2005-08-21 12:22 evolver.1 3.chmod - regular mode The format of a symbolic mode is ‘[ugoa...][[+-=][rwxXstugo...]...][,...]’. Multiple symbolic operations can be given, separated by commas. u = user, g = group, o = others, a = all r = read, w = write, x = execute, X = execute only if the file is a directory or already has execute permission for some user + permissions added, - permissions removed, = these will be the only permissions evan@ELEMLEY-LINUX:~/Desktop/evolver$ ls -l manual230.pdf -rw-r--r-- 1 evan evan 1437981 2008-01-04 06:54 manual230.pdf evan@ELEMLEY-LINUX:~/Desktop/evolver$ chmod u+wx,g+wx,o+w manual230.pdf evan@ELEMLEY-LINUX:~/Desktop/evolver$ ls -l manual230.pdf -rwxrwxrw- 1 evan evan 1437981 2008-01-04 06:54 manual230.pdf evan@ELEMLEY-LINUX:~/Desktop/evolver$ chmod o=r manual230.pdf evan@ELEMLEY-LINUX:~/Desktop/evolver$ ls -l manual230.pdf -rwxrwxr-- 1 evan evan 1437981 2008-01-04 06:54 manual230.pdf 4.chmod - octal mode (0-7) Four digits determine the changes First is user or group id (we will not use) - if you submit three values it is assumed you have not submitted this one. Second is user (4 = read, 2 = write, 1 = execute) Third is group (4 = read, 2 = write, 1 = execute) Fourth is others (4 = read, 2 = write, 1 = execute) If you want more than one permission just add the numbers - e.g. read+write = 4+2 = 6 read+write+execute = 4+2+1 = 7, read+execute = 4+1 = 5 evan@ELEMLEY-LINUX:~/Desktop/evolver$ ls -l manual230.pdf -rwxrw-rw- 1 evan evan 1437981 2008-01-04 06:54 manual230.pdf evan@ELEMLEY-LINUX:~/Desktop/evolver$ chmod 644 manual230.pdf evan@ELEMLEY-LINUX:~/Desktop/evolver$ ls -l manual230.pdf -rw-r--r-- 1 evan evan 1437981 2008-01-04 06:54 manual230.pdf 5.Redirection (>) To output the results of a single command use the '>' redirection operator to send the results to a file evan@ELEMLEY-LINUX:~/Desktop/evolver$ ls -Alt > dirlisting.txt evan@ELEMLEY-LINUX:~/Desktop/evolver$ cat dirlisting.txt total 4284 -rw-r--r-- 1 evan evan 0 2008-08-25 11:33 dirlisting.txt -rw-r--r-- 1 evan evan 4206 2008-08-25 10:45 test drwxr-xr-x 2 evan evan 4096 2008-02-26 14:14 src -rw-r--r-- 1 evan evan 2901023 2008-02-26 14:10 evolver-2.30c.tar.gz -rw-r--r-- 1 evan evan 1437981 2008-01-04 06:54 manual230.pdf drwxr-xr-x 2 evan evan 4096 2008-01-03 13:11 doc -rw-r--r-- 1 evan evan 5495 2008-01-03 11:54 README drwxr-xr-x 2 evan evan 4096 2008-01-03 11:38 fe -rwxr-xr-x 1 evan evan 3581 2005-08-21 12:22 evolver.1 6.grep - look for a word, or combo of words in files evan@ELEMLEY-LINUX:~/Desktop/evolver$ grep Quick README Quick start: Use ^ before to search for beginning of line and $ after to search end of line 7.piping (|) - pipe results of one command to another evan@ELEMLEY-LINUX:~/Desktop/evolver$ cat README test | grep Quick Quick start: