# with >/dev/null: $ time dd if=/dev/zero bs=1K count=100000 >/dev/null 100000+0 records in 100000+0 records out 102400000 bytes (102 MB) copied, 0.0355178 s, 2.9 GB/s real 0m0.037s user 0m0.011s sys 0m0.025s # with |: $ time dd if=/dev/zero bs=1K count=100000 |: real 0m0.002s user 0m0.000s sys 0m0.002s
Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?
You must be signed in to comment.
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for:
help ::: : Null command. No effect; the command does nothing. Exit Status: Always succeeds.ls |: ; echo ${PIPESTATUS[@]}141 0 where >/dev/null makes no errortime sh test/spew.sh > /dev/nullreal 0m0.285s user 0m0.148s sys 0m0.136stime sh test/spew.sh |:real 0m0.008s user 0m0.000s sys 0m0.008scat spew3.shfor i in `seq 1 100` do for j in `seq 1 100` do echo i done done I think this is the usage the author intended, and it does seem to be much faster.cat|:now type in some letters. See how they get echoed to the screen. Now hit a newline. What happens? . now contrast this with:cat>/dev/nullwhich will soak up all kinds of control char except ^drany:~$ time >/dev/nullreal 0m0.000suser 0m0.000ssys 0m0.000srany:~$ time :|:real 0m0.002suser 0m0.008ssys 0m0.000srany:~$ls fools: foo: No such file or directoryperl -e 'print 0 for 1..10000; open FOO, ">foo"' |:ls fools: foo: No such file or directoryperl -e 'print 0 for 1..10000; open FOO, ">foo"' > /dev/nullls foofootime for x in {1..1000} ; do cat /tmp/VAR.log >/dev/null ; donereal 0m2.956suser 0m0.320ssys 0m0.790stime for x in {1..1000} ; do cat /tmp/VAR.log :| ; done-bash: syntax error near unexpected token `;'time for x in {1..1000} ; do cat /tmp/VAR.log |: ; donereal 0m4.903suser 0m0.380ssys 0m1.480sanyway, it seems to take longer for me. Shorter to type though.