this is one:
ls -l . | egrep -c '^-'
Note:
ls -1 | wc -l
Which means:
ls
: list files in dir
-1
: (that’s a ONE) only one entry per line. Change it to -1a if you want hidden files too
|
: pipe output onto…
wc
: “wordcount”
-l
: count l
ines.
More Related Contents:
- how can i show the size of files in /proc? it should not be size zero
- How can I generate a list of files with their absolute path in Linux?
- List files recursively in Linux CLI with path relative to the current directory
- How to get file creation date/time in Bash/Debian?
- Is there a way for non-root processes to bind to “privileged” ports on Linux?
- Is it possible to use “/” in a filename?
- How to convert DOS/Windows newline (CRLF) to Unix newline (LF)
- How do I run a program with a different working directory from current, from Linux shell?
- How to make an executable ELF file in Linux using a hex editor?
- Separately redirecting and recombining stderr/stdout without losing ordering
- Print a file, skipping the first X lines, in Bash [duplicate]
- How do I view the list of functions a Linux shared library is exporting?
- How to start Solr automatically?
- How to change the default browser used by the ipython/jupyter notebook in Linux?
- why is the output of `du` often so different from `du -b`
- What is the difference between “source script.sh” and “./script.sh”?
- Running a cron job on Linux every six hours
- Shebang line limit in bash and linux kernel
- Error on execution -version `Qt_5′ not found required by
- How to search and replace using grep
- What is the status of POSIX asynchronous I/O (AIO)?
- Randomly shuffling lines in Linux / Bash
- What is the proper way to use inotify?
- How can I get the source code for the linux utility tail?
- How to convert hex to ASCII characters in the Linux shell?
- How to check if a program is run in Bash on Ubuntu on Windows and not just plain Ubuntu?
- Can I tell Linux not to swap out a particular processes’ memory?
- Proper way to reference files relative to application root in Node.JS
- Why no output is shown when using grep twice?
- What are the rules for valid identifiers (e.g. functions, vars, etc) in Bash?