How to see how many files or directories are in a Linux directory

Linux has different methods of determining how many files and directories are in a Linux directory. Below we have listed a few different methods of how you can display the number of files or directories in Linux.
Use the tree command
The tree command is a quick way to get a list of the files and directories, and a count of files and directories. Realize if tree is run without any additional parameters, it lists the number of files and directories in the current directory and subdirectories.
To list only the contents of the current directory, you can use the following command.
tree -i -L 1
Use echo in combination with wc
Users can also see how many files or folders are in a directory using the echo command in combination with the wc command. Below are few different examples of how this can be done.
Get a count of all files and directories in the current directory
echo * | wc
Once the command above is typed, you get an output similar to the example below. In this example, the "10" indicates the amount of directories and files in the current directory.
1 10 104
Get a count of only the directories in the current directory
echo */ | wc
Get a count of the files in a directory
The example command below is assuming all the files in the directory have extensions. If a file does not have an extension, it is not counted.
echo *.* | wc