-
Notifications
You must be signed in to change notification settings - Fork 0
Home
My name is Felipe Simionato Salles
GNU have a interface with
green is the terminal ~ is the way to your user terminal
-
stdinis represented by number 0, where data comes from to enter the program -
stdoutis represented by number 1, where data goes when it gets out of the program -
stderris represented by number 2, where program errors (or warnings or diagnostic messages) go to when issued
- less
- more
- tail
- head
- rev
- colrm
- mkdir
- cd
- wget
> redirect stdout to the file named after the sign
can create new files OR OVERWRITE AN EXIST FILE, so be carefull
$ file > other_file
2> redirect STDERR to the file / only the erro will and redirect to the file / can create new files OR OVERWRITE AN EXIST FILE
>> redirect, appending stdout to a file.
2>> redirect, appending stderr to a file.
redirect JUST A STARDAR ERROR (
stderr) AND appending to a existing file
$ file 2>> appending_staerr
< redirect stdin from a file to a programm
$ script_of_programm < file
<< redirect stdin as a here-document,
<<< redirect stdin as a here-string to a program
&&
&
- Merge
stdoutandstderrand send them to the same file
send the two streams to the same file
$ command_line > file 2>&1
### OR
$ command_line &> file
- Appending, without overwrite, the
stdoutandstderrin the previous exist file
$ command_line >> file 2>&1
### OR
command_line &>> file
command && command =
command & command = . = currently directory
.. = directory above currently directory
. is considerer any character. Represent a caracther with dot.
^ and $ anchor the beggin and the end of line, respectavely
- line couting how many lines start with
ATG
- substitute the end of the sequencies fasta with
TAAfor a blank space
$ grep -c '^ATG' file.fasta
$ sed 's/TAA$//' file.fasta
[ ] enclose a character list, so its something OR other thing. Can be used as a range also
- list-show just
file.a,file.b,file.c,file.d
- print numbers 1 to 10
$ ls file.[abcd]
$ echo [1..10]
[^ ] is the same as [ ] but negation the content among the brackets
show list files with don't started X OR Y OR Z
$ ls [^XYZ]*
* quantifier zero or more occurrences
\ remove the metacharacter "special power" and belong a normal characher, therefore is the literal value of the character
in some programms make the normal character change the mean and gives new power for them
| concatenate 2 or more commands in one line (its a pipe), redirect stdout of one program to stdin of the next program.
STDERRdoes not get in the pipe, by default, so use|&to have theSTDERRgo along withSTDOUT
$ command1 | <command2> | <command3>
- = match the preceding element one or more times ? = match the preceding element zero or one time ( ) = group some parts of the regex, and save the match in a special variable