cURL commands return no feedback when connecting to AEM

Issue

While executing cURL commands, no feedback is received from AEM. The terminal displays no results after the command execution.
For example, the command below returns nothing

curl -u admin:pass http://IP:PORT/

Cause

The cURL command does not display any results on the terminal because the response sent by AEM server contains no message in the body of the HTML response. Instead, the HTTP error code is displayed in the headers of the HTTP response.

Usually, the problem is either the user name and password provided in the curl command are not correct, or the credentials are not getting through as expected to the AEM server. To understand the problem, use -v flag in the cURL command to understand the nature of the error.

The following command, which returns no results can be modified as explained below:

Resolution

Confirm that the credentials used in the cURL command are accurate and a user can log in to AEM using the same credentials.

If the user is able to log in to AEM using the same credentials, then the issue is probably with the delivery of the credentials. In this case, wrapping the credentials in single quotes can resolve the issue. This is usually the case where there are some special characters in the password such as $,@, and so on.

curl -v -u 'admin:pass' http://IP:PORT/

Additional information

You can confirm if you are getting other errors by adding the -v flag to the curl command to include the HTTP headers in the output such as:
curl -v -u admin: admin http://localhost:4502/crx/packmgr/service.jsp?cmd=help