<commit_before>---
layout: post
title:  "UNIX"
date:   2016-10-09 09:45:31
categories: notes
author: "<NAME>"
---
<p>Collected some common UNIX commands.</p>
<pre>
	ps aux | grep foo | grep -v grep | awk '{print $2}' | xargs kill
</pre>
1. `|`pipe: You can connect two commands together so that the output from one program becomes the input of the next program. Two or more commands connected in this way form a pipe.
2. `ps aux`: list all running process by #ID
	a = show processes for all users
	u = display the process's user/owner
	x = also show processes not attached to a terminal

3. `grep "xx"`: search files for 'xx'

4. `grep -v`: **invert match**

5. `grep -v grep`: not list grep's process ID

4. `awk '{print $2}’`: print out second column

5. `xargs kill`: kill all PID’s running process

[e.g. from StackOverflow](http://stackoverflow.com/questions/3510673/find-and-kill-a-process-in-one-line-using-bash-and-regex)

<pre>
tail -f /var/log/syslog<commit_msg>Update 2016-10-09-unix.markdown<commit_after>---
layout: post
title:  "UNIX"
date:   2016-10-09 09:45:31 +5300
categories: notes
author: "<NAME>"
---
<p>Collected some common UNIX commands.</p>
<pre>
	ps aux | grep foo | grep -v grep | awk '{print $2}' | xargs kill
</pre>
1. `|`pipe: You can connect two commands together so that the output from one program becomes the input of the next program. Two or more commands connected in this way form a pipe.
2. `ps aux`: list all running process by #ID
	a = show processes for all users
	u = display the process's user/owner
	x = also show processes not attached to a terminal

3. `grep "xx"`: search files for 'xx'

4. `grep -v`: **invert match**

5. `grep -v grep`: not list grep's process ID

4. `awk '{print $2}’`: print out second column

5. `xargs kill`: kill all PID’s running process

[e.g. from StackOverflow](http://stackoverflow.com/questions/3510673/find-and-kill-a-process-in-one-line-using-bash-and-regex)

<pre>
tail -f /var/log/syslog
{'fraction_non_alphanumeric': 0.13363821138211382, 'fraction_numerical': 0.036585365853658534, 'mean_word_length': 3.721822541966427, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '4868252', 'n_tokens_mistral': 729, 'n_tokens_neox': 665, 'n_words': 275}