Ubuntu – How to view the list of c library functions

13.10ccommand lineglibcprogramming

I'm a newbie in Linux programming. I found that the way to view the list of system calls in Linux via command-line is:

man syscalls

But now I want to view the list of c library functions, how can I do that? Which command will help me list the c library functions? And another question, where are system calls and c library functions manual pages located? Thank you.

Best Answer

There is a nice package to display C function header, named ref. To know more about it see man ref. It has a good database where you can find the list of C library functions.

The functions are listed in the file /usr/share/elvis/stubs/ansistub.c. You can directly look into it to see the functions, or you can filter them as you wish.

You can use the following big line in your terminal to see the full list at once,

cat /usr/share/elvis/stubs/ansistub.c | grep "^int\|^char\|^void\|^double\|^ldiv_t\|^unsigned\|^type\|^struct\|^FILE\|^size_t\|^time_t\|^long\|^clock\|^mbstowcs\|^div_t" | awk 'NR > 12' | less

You will get Output like

void abort(void)
int abs(int num)
double acos(double cosvalue)
char *asctime(const struct tm *currtime)
double asin(double sinvalue)
void assert(int expression)
int atexit(void(*func)(void))
long int atol(const char *string)


Or you can copy the list to a file myCfunction.list using,

cat /usr/share/elvis/stubs/ansistub.c | grep "^int\|^char\|^void\|^double\|^ldiv_t\|^unsigned\|^type\|^struct\|^FILE\|^size_t\|^time_t\|^long\|^clock\|^mbstowcs\|^div_t" | awk 'NR > 12' > myCfunction.list

To use it first install ref using the command below,

sudo apt-get install elvis-tools