<commit_before># Who Cares?

Why is all of this so important?

### POWER!

In a unix environment, each command is meant to do one and only one thing. By chaining commands and data together using piping and redirection you get more flexibility.

## Examples

### To see if a java process is running

```
BabyMac:~ jennapederson$ ps -ef | grep java
```

This can be useful because this command will output the process id. You could even pipe this process id to the kill command to magically kill the java process that was running.

### To find your favorite command

I have my history set to remember something like 10k of the last commands I've typed but sometimes I don't remember what the specific command is I am looking for.

```
➜  vagrant git:(master) ✗ history | grep cap
 1866  git commit -m "Change to small caps and go back to default font size"
 1868  git commit -m "Change to small caps and go back to default font size"
 3906  git commit -m "Change to use on stateChangeSuccess; Fix how events are tracked so data is captured correctly"<commit_msg>Add example<commit_after># Who Cares?

Why is all of this so important?

### POWER!

In a unix environment, each command is meant to do one and only one thing. By chaining commands and data together using piping and redirection you get more flexibility.

## Examples

### To see if a java process is running

```
BabyMac:~ jennapederson$ ps -ef | grep java
```

This can be useful because this command will output the process id. You could even pipe this process id to the kill command to magically kill the java process that was running.

### To add your logo to the lower right corner of all your photos

Here we are piping the output of the `ls` command to a `while` loop which reads over each line which we've shoved into a variabled called `img`. Then we call the composite command and pass in the `img` to be processed and written out to a different directory.

```
BabyMac:~ jennapederson$ ls HTG*.jpg | while read img
do
    composite -geometry +90+90 -gravity SouthEast hackthegap-logo-no-date1200.png $img processed/$img
done
```

### To find your favorite command

I have my history set to remember something like 10k of the last commands I've typed but sometimes I don't remember what the specific command is I am looking for.

```
➜  vagrant git:(master) ✗ history | grep cap
 1866  git commit -m "Change to small caps and go back to default font size"
 1868  git commit -m "Change to small caps and go back to default font size"
 3906  git commit -m "Change to use on stateChangeSuccess; Fix how events are tracked so data is captured correctly"
{'fraction_non_alphanumeric': 0.056891943489881636, 'fraction_numerical': 0.013745704467353952, 'mean_word_length': 3.9904761904761905, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2795874', 'n_tokens_mistral': 746, 'n_tokens_neox': 686, 'n_words': 434}