Added in data stream info
This commit is contained in:
parent
0d44c67874
commit
0ceecf3423
@ -1,6 +1,6 @@
|
|||||||
#Commands
|
# Commands
|
||||||
|
|
||||||
## Files
|
## Manipulating files
|
||||||
|
|
||||||
Commands that can be used for reading and manipulating files
|
Commands that can be used for reading and manipulating files
|
||||||
|
|
||||||
@ -49,8 +49,12 @@ Commands that can be used for reading and manipulating files
|
|||||||
|
|
||||||
Some examples of grep usage can be found [here](/examples/grep)
|
Some examples of grep usage can be found [here](/examples/grep)
|
||||||
|
|
||||||
### losof
|
### lsof
|
||||||
|
|
||||||
`lsof` is a command that will show you what processes have specified file open currently you can see an example [here](/examples/lsof)
|
`lsof` is a command that will show you what processes have specified file open currently you can see an example [here](/examples/lsof)
|
||||||
|
|
||||||
|
## Manipulating the standard input
|
||||||
|
|
||||||
|
These commands can be used to manipulate data in the standard input
|
||||||
|
|
||||||
### rev
|
### rev
|
||||||
@ -1,6 +1,8 @@
|
|||||||
# lsof examples
|
# lsof examples
|
||||||
|
|
||||||
`[ben@jamyn] ~/Documents/Projects/Python/mkdocs-pages$ lsof docs/index.md`
|
In this example we can see that the docs/index.md file is currently open by the tail command
|
||||||
|
|
||||||
|
`[ben@jamyn ~/Documents/Projects/Python/mkdocs-pages]$ lsof docs/index.md`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
|
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
#Regex examples
|
# Regex examples
|
||||||
|
|
||||||
##Match an IP address
|
## Match an IP address
|
||||||
`\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}`
|
`\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}`
|
||||||
|
|
||||||
If we use this expression on the following using grep to search the file
|
If we use this expression on the following using grep to search the file
|
||||||
|
|
||||||
`grep -oP '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}' log.txt'`
|
`grep -oP '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}' log.txt'`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
103.252.153.201
|
103.252.153.201
|
||||||
127.0.0.1 - - [30/Dec/2018 22:43:01] "GET / HTTP/1.0" 200 -
|
127.0.0.1 - - [30/Dec/2018 22:43:01] "GET / HTTP/1.0" 200 -
|
||||||
|
|||||||
19
docs/shellbasics.md
Normal file
19
docs/shellbasics.md
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Basics of the linux shell
|
||||||
|
|
||||||
|
## Streams
|
||||||
|
|
||||||
|
The linux shell (this will usually be [`bash`](bash.md)) works using different streams
|
||||||
|
|
||||||
|
The main three streams that are used on the command line are STDIN (Standard input), STDOUT (Standard output), STDERR (Standard Error)
|
||||||
|
|
||||||
|
|ID|STREAM|USE|
|
||||||
|
|---|:----|:---|
|
||||||
|
| 0 | STDIN | Used to send input to the program |
|
||||||
|
| 1 | STDOUT | Used to receive output from the program |
|
||||||
|
| 2 | STDERR | Used to receive errors from the program |
|
||||||
|
|
||||||
|
### Standard Input
|
||||||
|
|
||||||
|
Standard input is how we send input to an application it is also how we interact with the command line shell (Usually [`bash`](/bash.md))
|
||||||
|
|
||||||
|
Once thing that makes the linux command line so powerfull is the suite of commands that is provided all work using STDIN, STDOUT and STDERR you can pipe information from one stream to another (i.e the STDOUT from one program can be in STDIN to another)
|
||||||
Loading…
x
Reference in New Issue
Block a user