COUNT(1)
β¨ COUNT π (fish-shell manual, bestie edition)
okay so you're here for count from the fish-shell manual β periodt, let's go π
πΈ NAME πΈ
count β literally just counts how many elements are in a list, that's the whole gig π
π¦ SYNOPSIS π¦
count STRING1 STRING2 ...
COMMAND | count
count [...] < FILE
β¨ DESCRIPTION β¨
okay so count prints the number of arguments that were passed to it, plus the number of newlines that got passed to it via stdin. that's it, that's the vibe π«Ά
most of the time you're using this to find out how many elements an environment variable list contains, or how many lines there are in a text file. very demure, very useful.
π¨ heads up bestie:countdoes not accept any options. not even-hor--help. it's giving "no thoughts, head empty, just numbers" β do not try it, it will not slay π
here's the exit status tea β: count exits with a non-zero exit status if no arguments were passed to it, and with zero if at least one argument was passed. so no args = sad girl hours, one arg = we're so back π
also, note that, like wc -l, reading from stdin counts newlines, so echo -n foo | count will print 0. yes really. no newline, no count, no cap π
π EXAMPLE π
count $PATH
# Returns the number of directories in the users PATH variable.
count *.txt
# Returns the number of files in the current working directory
# ending with the suffix '.txt'.
git ls-files --others --exclude-standard | count
# Returns the number of untracked files in a git repository
printf '%s\n' foo bar | count baz
# Returns 3 (2 lines from stdin plus 1 argument)
count < /etc/hosts
# Counts the number of entries in the hosts file
see? iconic. every single one of these is a main character move π
π Copyright
fish-shell developers π
okay that's the whole page, bestie β go forth and count things π¦π
sign-off szn: this was count from fish-shell, version 4.9, dated Sep 08, 2026 β noting it here in the cute lil footer way instead of pasting the boring footer line, iykyk πβ¨π₯
π¦ where this page comes from
- arch rolling: fish 4.9.3-1 Β· GPL-2.0-only AND BSD-3-Clause AND ISC AND MIT AND PSF-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms