Could someone please let me know what does it mean when I type $?
in Unix?
root@kb:~# echo $?
127
root@kb:~# wc -l
root@kb:~#
root@kb:~# echo $?
130
As the comments say, "$?" holds the return status code from the last command executed. Each command is free to return whatever value it wants, and those values mean whatever they say in the man page for that particular command, but in general, most unix commands return zero (0) on successful completion, and various non-zero (usually positive) numbers to indicate a variety of exit conditions.
A few sample "special" exit codes can be found here:
man bash
.$?
is the exit code of the last executed foreground pipeline (e.g. a simple command).