whiteletters in blankpapers whiteletters in blankpapers - 4 months ago 22
Linux Question

How to Find Server’s IP address in Ubuntu?

It is the first time I use a Linux distribution and I find --help very difficult to use in order to unserstand the following command:

ifconfig eth0 | grep inet | awk '{ print $2 }'


Someone to explain to me please what the words of this command do? what is the name of
|
in english?
Thanks

Answer

The | sign called pipeline and it is an operator that sends the output of the command in it left side as the input of the command in it right side.

So basicly, you have 3 commands:

ifconfig eth0

which outputs many details on your network, then you send that output to:

grep inet

which takes only the lines that contain the word inet and send that to:

awk '{ print $2 }'

which print the just seconed word.