Simple but quite powerful command

Standard error (stderr)

[root@ip-192-168-1-57 ec2-user]# fdafda > error.txt

bash: fdafda: command not found

[root@ip-192-168-1-57 ec2-user]# cat error.txt

[root@ip-192-168-1-57 ec2-user]#

[root@ip-192-168-1-57 ec2-user]# fdafda 2> error.txt

[root@ip-192-168-1-57 ec2-user]# cat error.txt

bash: fdafda: command not found

Redirect Stderr to Stdout

[root@ip-192-168-1-57 log]# ls -ly > lstest.txt 2>&1   (2> means stderr, &1 means stdout )

[root@ip-192-168-1-57 log]#

[root@ip-192-168-1-57 log]#

[root@ip-192-168-1-57 log]# more lstest.txt

ls: invalid option — ‘y’

Try ‘ls –help’ for more information.

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s