Piping and Redirection
1.Redirect
Standard Input (STDIN)
Data fed into the program
Standard Output (STDOUT)
Output from the program
Standard Error (STDERR)
Error messages (defaults to)
Type Standard
Standard Input 0 ( STDIN )
Standard Output 1 ( STDOUT )
Standard Error 2 ( STDERR )

Redirecting to an Existing File
In Case Redirect Output , U Can Using
>
Operator To Store Or Redirect Output In File
kali@kali:~$ echo "that is maintained and funded by Offensive Security" >>
redirection_test.txt
kali@kali:~$ cat redirection_test.txt
Kali Linux is an open source project
that is maintained and funded by Offensive Security

Redirecting from a File
root@root:~$ wc -m < php.php
89
Redirecting to a New File
kali@kali:~$ ls
Desktop Documents Downloads Music Pictures Public Templates Videos
kali@kali:~$ echo "test"
test
kali@kali:~$ echo "test" > redirection_test.txt
kali@kali:~$ ls
Desktop Documents Downloads Music Pictures Public redirection_test.txt Template
kali@kali:~$ cat redirection_test.txt
test
kali@kali:~$ echo "Kali Linux is an open source project" > redirection_test.txt
kali@kali:~$ cat redirection_test.txt
Kali Linux is an open source project
In Case Insert In File Not Use Override In Case Using Just
>
U Can Use>>
To Insert In File , And Save The Old Value

Redirecting STDERR
kali@kali:~$ ls .
Desktop Documents Downloads Music Pictures Public redirection_test.txt Template
kali@kali:~$ ls ./test
ls: cannot access '/test': No such file or directory
kali@kali:~$ ls ./test 2>error.txt
in Case Passing STRDINT Standard Input Using
<

2.Piping

Return Result From 1st Function Or Output And Passing As A Value To 2nd Tool Or Function
tee
Command Using To Show Result And Store In File , U Can Append In File Because IF U Use Normal Use Delete Old Data, U Can Use Switch-a
To Appendls | tee -a
And U Can Using Other
xargs
To Control Result And Execute Same Actions

Last updated