LINUX FUNDAMENTALS - File Descriptors and Redirections

hi, I am new to all of this and I am stuck on a very simple command :wink:
I want to find how many total packages are installed on the remote machine.
I have tried
dpkg -l | wc -l
dpkg --get-selections | grep install | wc -l
apt list | wc -l

Nothing from above is correct and every single of them has another result.
Has anyone an idea what’s going wrong?

playing around with grep piping I’ve got it.

Type your comment> @Numenorean said:

playing around with grep piping I’ve got it.

Can you tell me what command did you use?

This one did it for me
dpkg -l | grep -c '^ii'

More info here: