tee - read from input and write to output and files

difference > and pipe tee

with pipe tee you can see the output and set privileges

$ echo “deb http://repo.mongodb.org/apt/ubuntu “$(lsb_release -sc)”/mongodb-org/3.0 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

Using tee let's you split the output. You can either view it (by directing stdout to the tty you are looking at) or pass it on to further processing.

Another benefit: you can do echo a | sudo tee protected-file, meaning you don't need to elevate the privileges for the first command

Comments

Popular posts from this blog

HAproxy logging

tomcat catalina coyote jasper cluster

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all