You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.org
+41-23
Original file line number
Diff line number
Diff line change
@@ -3,32 +3,32 @@
3
3
4
4
#+TITLE: Unix Shell
5
5
#+AUTHOR: Derek Devnich
6
-
#+BEGIN_SRC bash
7
-
8
-
#+END_SRC
9
-
#+BEGIN_EXAMPLE
10
-
#+END_EXAMPLE
11
6
12
7
* Introducing the shell
13
-
Powerpoint slides: "Automate all the things!"
14
-
15
8
** Reasons to use the shell
16
9
1. Automate basic tasks
17
-
2. Underlies many other open source languages and applications; knowing the shell will make you better at using them
18
-
3. System administration, HPC, and remote computing
19
-
4. Many special-purpose tools become available to you
10
+
2. Underlies many other open source languages and applications and can be used to glue them together
11
+
3. Essential for system administration, remote computing, and high-performance computing
12
+
4. Many concise special-purpose tools that can make your life easier
13
+
5. Complements more fully-featured application programming languages
14
+
15
+
** "Unix"
16
+
Powerpoint slides: Unix family tree
17
+
1. Unix-like operation systems share a common architecture and layout
18
+
2. Roughly compatible, with similar (or identical) shells and tools
19
+
3. The environment in which most open-source software was written
20
+
21
+
** "Shell"
22
+
- Broadly speaking, there is a tension between making computer systems fast and making them easy to use.
23
+
- A common solution is to create a 2-layer architecture: A fast, somewhat opaque core surrounded by a more friendly scriptable interface (also referred to as "hooks" or an "API"). Examples of this include video games, Emacs and other highly customizable code editors, and high-level special-purpose languages like Stata and Mathematica.
24
+
- Unix shell is the scriptable *shell* around the operating system. It provides a simple interface for making the operating system do work, without having to know exactly how it accomplishes that work.
20
25
21
26
** The past is always with us
22
27
The design and terminology of modern computers is based on metaphors from a previous age.
23
28
1. Files and folders
24
29
2. Teletype input and output
25
30
3. Modern touch devices don't expose the file system, so you may be less comfortable with navigating directory trees than people whose primary computing devices were desktop computers
26
31
27
-
** So what is a "shell"?
28
-
- Broadly speaking, there is a tension between making computer systems fast and making them easy to use.
29
-
- A common solution is to create a 2-layer architecture: A fast, somewhat opaque core surrounded by a more friendly scriptable interface (also referred to as "hooks" or an "API"). Examples of this include video games, Emacs and other highly customizable code editors, and high-level special-purpose languages like Stata and Mathematica.
30
-
- Unix shell is the scriptable *shell* around the operating system. It provides a simple interface for making the operating system do work, without having to know exactly how it accomplishes that work.
31
-
32
32
* Navigating files and directories
33
33
** File system layout
34
34
Powerpoint slides: "Navigating files and directories"
@@ -522,6 +522,22 @@ bash latin.sh
522
522
bash aggregate.sh ../proteins/*.pdb
523
523
#+END_SRC
524
524
525
+
** Make your script executable
526
+
#+BEGIN_SRC bash
527
+
# List file in long format to show current permissions
528
+
ls -l aggregate.sh
529
+
530
+
# Change file mode (i.e. permissions)
531
+
# User can read/write/execute, Group and Other can read
532
+
chmod u=rwx,go=r aggregate.sh
533
+
534
+
# Show changed permissions
535
+
ls -l aggregate.sh
536
+
537
+
# Invoke script
538
+
./aggregate.sh ../proteins/*.pdb
539
+
#+END_SRC
540
+
525
541
* Finding things
526
542
** Find
527
543
*** Find everything
@@ -549,16 +565,18 @@ find . -name "*.txt"
549
565
#+END_SRC
550
566
551
567
** Grep
568
+
TBD
552
569
553
570
* Shell extras
554
-
** SSH
555
-
** Permissions
556
-
** Job control
557
-
** Aliases and bash customization
558
-
** More on shell variables
559
-
** Mini-languages (grep, sed, AWK)
560
-
** Shell expansion
561
-
** Conditional tests
571
+
Consult the Wooledge Bash Guide (see references below) for more on these topics:
572
+
1. SSH
573
+
2. Permissions
574
+
3. Job control
575
+
4. Aliases and bash customization
576
+
5. Shell variables
577
+
6. Mini-languages (grep, sed, AWK)
578
+
7. Shell expansion
579
+
8. Conditional tests
562
580
563
581
* Credits
564
582
1. The Unix Shell: https://swcarpentry.github.io/shell-novice/
0 commit comments