Reputation: 8995
I have
wget -O /dev/null http://example.com/job.php 2>/dev/null
However I don't know what does it really mean? The only thing I know is that it uses the application called wget and one of the parameters is the page that I want to run. The other things, I have no idea. -O /dev/null
and 2>/dev/null
?
Note: This is from a cPanel running on FreeBSD.
Upvotes: 0
Views: 388
Reputation: 290015
This command will not show anything in your screen, neither write any file in your computer.
Let's focus in each part:
wget -O /dev/null http://example.com/job.php 2>/dev/null
/dev/null is a special file that discards all data written to it but reports that the write operation succeeded. (Wikipedia)
So whenever we write or redirect something to /dev/null
the data will not be saved.
As wget -O file
stands for downloading the webpage to file
, wget -O /dev/null
will simply download it but will not be found.
$ wget www.google.cat **-o test**
--2013-05-25 16:42:09-- http://www.google.cat/
Resolving www.google.cat (www.google.cat)... 173.194.78.94, 2a00:1450:400c:c05::5e
Connecting to www.google.cat (www.google.cat)|173.194.78.94|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `index.html'
[ <=> ] 11,086 --.-K/s in 0.007s
2013-05-25 16:42:09 (1.62 MB/s) - `test' saved [11086]
$ ll
-rw-rw-r-- 1 me me 11086 May 25 16:42 test
$ wget www.google.cat **-O /dev/null**
--2013-05-25 16:51:39-- http://www.google.cat/
Resolving www.google.cat (www.google.cat)... 173.194.78.94, 2a00:1450:400c:c06::5e
Connecting to www.google.cat (www.google.cat)|173.194.78.94|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `/dev/null'
[ <=> ] 11,118 --.-K/s in 0.004s
2013-05-25 16:51:39 (2.66 MB/s) - `/dev/null' saved [11118]
$ ll
total 0
Regarding the other part:
2>/dev/null
2
stands for stderr. So 2 > /devnull
redirects the possible errors of wget
execution so that they do not appear in your screen.
You can check some examples or wget usage.
Upvotes: 1
Reputation: 1373
Your command wget simply sends a GET request to the URL specified.
2> /dev/null -> send errors to /dev/null (means send to nothing).
So errors are not logged.
Upvotes: 2