RTFM.WIKI

Ordnung muß sein. Ordnung über alles (18+)

Инструменты пользователя

Инструменты сайта


Боковая панель


Навигация

Линкшэринг

ALARM!

Добавить новую страницу

You are not allowed to add pages
linux:redirection_cheat_sheet


Linux Redirection Cheat Sheet

via http://www.adminsehow.com/2011/06/linux-redirection-cheat-sheet/

Normal Redirect:
 
command > filename        Redirect command output to a file
command >> filename       APPEND into a file
command < filename        Type a text file and pass the text to command
commandA  |  commandB     Pipe the output from commandA into commandB
commandA &  commandB      Run commandA and then run commandB
commandA && commandB      Run commandA, if it succeeds then run commandB
commandA || commandB      Run commandA, if it fails then run commandB
 
Numeric handles:
 
STDIN  = 0  Keyboard input
STDOUT = 1  Text output
STDERR = 2  Error text output
UNDEFINED = 3-9
 
command 2> filename       Redirect any error message into a file
command 2>> filename      Append any error message into a file
command > file 2>&1       Redirect errors and output to one file
command > file 2<&1       Redirect output and errors to one file
command > fileA 2> fileB  Redirect output and errors to separate files
command 2>&1 >filename    This will fail!
 
Redirect to /dev/null (hide errors):
 
command 2> /dev/null            Redirect error messages to /dev/null
command >/dev/null 2>&1         Redirect error and output to /dev/null
command >filename 2> /dev/null  Redirect output to file but suppress error
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies

Discussion

Enter your comment. Wiki syntax is allowed:
 
linux/redirection_cheat_sheet.txt · Последнее изменение: 2014/10/24 13:16 (внешнее изменение)