More Unix magic

Bash: copying, moving, removing files

Bash: examining file contents

Bash: power of the command line

Emacs: Moving text around

You can also use OS-X copying (⌘-c) and pasting (⌘-v). (Why not cutting??). And you can use OS-X commands [shift]-⌘-[plus] and ⌘-[minus] to enlarge and shrink windows.

Bash: Background / Foreground

Within any running program (including editing a file with emacs) you can suspend the currently running program with [ctrl]-z, placing it in the 'background'. You'll find yourself back at the command-line prompt.

Return to a previously suspended program by issuing the foreground command:

fg

When you eventually exit bash to finish up your session, you'll be reminded if you have still have background items.

Unix toolbox philosophy

The toolbox philosophy means writing many small utilities that can be chained together (today: 'mash ups') to do powerful things. For example, with a text file named 'junk' that contains three lines:

$ cat junk
1 the first line
3 line numbered 3
2 the second line
$ cat junk | sort |more
1 the first line
2 the second line
3 line numbered 3

Pipes and re-direction

Most Unix utilities respond to commands from the keyboard, or 'stdin'. But using the pipe operator | in the previous example, they can get their input from other sources (a text file, or the output from another utility) instead.

You can use the redirection operator > to send the output of a utility to a file instead of to the screen ('stdout') like this:

$ cat junk | sort > sortedfile
$ cat sortedfile
1 the first line
2 the second line
3 line numbered 3