Updated some formatting and added a log checker page

This commit is contained in:
benjamyn committed 2019-02-26 21:11:31 +11:00
1 parent bee36a5296
commit c566f3b637
5 files changed
+48 -13

No files matched your search

+8 -10
View File
@@ -1,8 +1,6 @@
# Basics
Basics of the Linux Shell
Basics of how the linux shell can be used to interact with programs
## Streams
@@ -17,7 +15,7 @@ STREAM ID STREAM NAME STREAM USE
2 STDERR Used to receive errors from the program
```
#### Standard Input
### Standard Input
Standard input is how we send input to an program it is also how we interact with the command line shell (Usually [`bash`](/Linux/bash.md))
@@ -27,15 +25,15 @@ The STDIN stream can also be refrenced by the '-' char in a command line program
One 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)
### Input Redirection
#### Input Redirection
You can use redirection to send information to a program using the '<' symbol i.e `cat < file` this will push the contents of 'file' to cat using STDIN
#### Standard Output
### Standard Output
Standard output is how we get the output from a program, usually this is printed directly to the terminal
### Output Redirection
#### Output Redirection
You can redirect the STDOUT of a program is a few ways you can use the '>' symbol to push the information from the programs output and saves it in a file for example `ls > filelist` will take the output of ls and saves it in the filelist file
@@ -43,18 +41,18 @@ You can also redirect the STDOUT of one program to another programs STDIN using
For example you can use `ls -alh | grep filename` this will list the files in the current directory and then passes the STDOUT to the STDIN for grep, this causes grep to use the output of ls as the input data to work with so the output of ls is searched for the string 'filename'
#### Standard Error
### Standard Error
Standard error is how error messages are sent between programs or displayed to the user
As this is a different to STDOUT you will still get output to the terminal if you redirect using the '>' symbol
### Error Redirection
#### Error Redirection
Errors can be redirected using the following '2>' this specifies the stream to redirect and the direction
For example you can redirect errors of an program to an error log file using '2> error.log' so a command that uses this would look like `find / -name "filename" 2> errors.log` this would make an error.log in the directory you are in and save the errors in a log and show the results from STDOUT on the screen (In this example the errors that you would see are `Permission Denied` errors)
#### More redirection tips
### More redirection tips
You can do quite a bit with piping and redirection, using these basics you will be able to do quite a bit in the bash shell I have created some examples both to show how programs can work together and provide some real world examples on what it can be used for [here](/examples/redirection)