linux 应用层常用API/命令

一 API

1. bsearch

NAME
bsearch - binary search of a sorted array

SYNOPSIS
#include <stdlib.h>

void *bsearch(const void *key, const void *base,
size_t nmemb, size_t size,
int (*compar)(const void *, const void *));

2. isdigit

isdigit()
checks for a digit (0 through 9).

3. 数组赋值 int arr[MAX] = {[0 ... (MAX - 1)] = 0};

4. qsort

NAME
qsort, qsort_r - sort an array

SYNOPSIS
#include <stdlib.h>

void qsort(void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *));

void qsort_r(void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *, void *),
void *arg);

二 命令

1. 查看config:zcat /proc/config.gz 或 cat /boot/config_xxx

2. 查看sysctrl -a 可配置项

3. sudo sysctl -w fs.inotify.max_user_watches="65535000" 设置文件描述符watch个数

4. sudo systemctl enable ssh 默认开启ssh服务

5. 打包logs目录成多个包,每个最大为10MB:tar cjf - logs/ |split -b 10m - logs.tar.bz2.

     解包:cat logs.tar.bz2.a* | tar xj

原文地址:https://www.cnblogs.com/zengjianrong/p/12092619.html