how to use wp_query

I need to manipulate wp_query but can't understand how it works after reading codex.

for instance, in functions.php of my child theme, I add this code, thinking it will display the requested url:

global $wp_query;
echo 'query' . $wp_query->$query;

but nothing is displayed.

So, what is wrong in my code, and where should I put it if I want to modify the query?