Q:

How to know if bitcoind synced?

I installed the bitcoind and started it as daemon.
After 10hours I've tried "du -h"
ubuntu@ip-172-31-37-93:~/.bitcoin$ du -h
16K     ./database
59M     ./blocks/index
29G     ./blocks
646M    ./chainstate
30G     . 

How to know if it synced or not?
UPD found an interesting script to monitor node sync status How to check Bitcoind block chain download progress level

A:

You can compare the block count from Blockexplorer with your local block count. Something like this:

$ wget -q -O- https://blockexplorer.com/q/getblockcount; echo
359721
$ bitcoin-cli -conf=/u0/bitcoin/bitcoin.conf getblockcount
359721

As you can see above my node is synched since the counter is equal.

A:

bitcoind logs the current sync status to its debug.log file:
$ tailf ~/.bitcoin/debug.log
2017-05-26 03:49:16 UpdateTip: new best=0000000000000001e0b7c8cffb8e7fa23909b8728913663decfaebffe24ca689 height=280022 version=0x00000002 log2_work=75.644236 tx=30854900 date='2014-01-12 03:50:07' **progress=0.137838** cache=312.7MiB(396972tx)
…

The field progress=0.137838 means that I'm currently ~13.7838% synced.

A:

test my masterpiece:
#!/bin/bash
coin="$1";
if [ -z $coin ]; then
        /bin/echo "No coin given... using btc as default";
        coin="bitcoin";
fi
count=$(/usr/local/bin/${coin}-cli getblockcount);
/bin/echo "block count: $count";

hash=$(/usr/local/bin/${coin}-cli getblockhash $count);
/bin/echo "block hash: $hash";

t=$(/usr/local/bin/${coin}-cli getblock "$hash" | grep '"time"' | awk '{print $2}' | sed -e 's/,$//g');
/bin/echo "block timestamp is: $t";

cur_t=$(date +%s);
diff_t=$[$cur_t - $t];
/bin/echo -n "Difference is: ";
/bin/echo $diff_t | /usr/bin/awk '{printf "%d days, %d:%d:%d\n",$1/(60*60*24),$1/(60*60)%24,$1%(60*60)/60,$1%60}';

Usage:
$ bash masterpiece.sh bitcoin
block count: 525432
block hash: 000000000000000000373849d360010906852493fc3f8e51c3b6063de1ac70e8
block timestamp is: 1527848948
Difference is: 0 days, 0:10:11

