Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I list all the printable ASCII characters in the terminal?

share|improve this question
add comment

3 Answers

up vote 5 down vote accepted

Try with printf:

 for((i=32;i<=127;i++)) do printf \\$(printf '%03o\t' "$i"); done;printf "\n"

See also : BASH FAQ

share|improve this answer
Or, the same idea, using a differnt way to get the octal value: for((i=32;i<=127;i++)) do printf "\\$((i/64*100+i%64/8*10+i%8))\t"; done;printf "\n" ... –  Peter.O Jun 17 '11 at 19:34
Or using the bash builtin echo... for((i=32;i<=127;i++)) do eval echo -ne $\'\\$((i/64*100+i%64/8*10+i%8))\'"\\\t"; done; echo –  Peter.O Jun 17 '11 at 20:40
add comment

You can do:

man ascii

to see the whole set of ascii characters.

share|improve this answer
or just ascii. –  jmtd Jun 17 '11 at 9:23
add comment

More an awk solution that a (pure) shell one but here it is anyway:

awk 'BEGIN{for(i=32;i<128;i++)printf "%c",i}';echo
share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.