In question "How many total packages are installed on the target system?" different results with grep and wc

Can anybody explain me why when I ““apt list --installed | wc -l”” and apt list --installed | grep -c “installed” to find the installed packages there are different results?

1 Like

When use the first command, “apt list --installed | wc -l”, it will include an additional line at the top saying “WARNING: apt does not have a stable CLI interface. Use with caution in scripts.” Therefore, its result is 1 greater than the latter’s result :slight_smile:

4 Likes