1. linux下面一切都是可以配置的
#vim可以有 .vimrc文件

#------.vimrc开始----
set vb t_vb=
set number
syntax on
set hlsearch
"set autoindent
"set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
"set textwidth=72
set fileencoding=utf-8
set fenc=utf-8
set incsearch
set novisualbell
"match Underlined /\%>72v.*/
"colo darkblue
let html_no_pre = 1 
let html_use_encoding='utf-8'
set encoding=utf-8
set langmenu=zh_CN.UTF-8
language message zh_CN.UTF-8
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
#-------.vimrc结束----------

#mysql可以有my.cnf文件


#linux用户有个.profile文件

#chmod问题解决:
+增加 -删除 =赋值   
r4读 w2写 x1执行 
u user g group o other 
s 设置用户组号 t 只有属主能改

 

  1. git用起来很方便
git clone project.git.address

修改

git status
git add .
git add filename
git commit -m "message"
git pull
git push -u origin branchname

就成功的将本地的修改上传到github主页上去了
  1. Makefile文件的编写

了解了$@ (目标文件)$< (第一个依赖的文件) $^ (所有依赖的文件) wildcard (扩展通配符)

$@ 目标文件

$<  第一个依赖的文件

$^  所有依赖的文件

 

CC  C编译器

CCFLAGS  C编译器选项

 

wildcard : 扩展通配符

notdir : 去除路径

patsubst :替换通配符

 

练习:

SRCS=$(wildcard *.c)

OBJS=$(SRCS:.c=.o)

CC=gcc

 

wshell:$(OBJS)

$(CC) -o $^ $@

 

%.o:%.c 

$(CC) -c $<   

 

clean:

rm -f *.o 

 

.PHONY:clean 

  1. 进程相关的函数

pid_t getpid();  进程号
pid_t getppid(); 父进程号
uid_t getuid(); 进程所有者ID
uid_t geteuid(); 进程有效用户ID
gid_t getgid();  用户组ID
gid_t getegid(); 有效用户组ID
  1.  c语言中的一些编程经验

 

struct中的元素用->来取
(struct passwd{//};//申明一个结构体
struct passwd *getpwuid(uid_t uid){//};//返回值为结构体的函数,需要pwd.h和sys/types.h
  my_info->pw_name  )

char *getcwd(char *buffer,size_t size);//需要unistd.h,将当前的工作目录绝对路径复制到参数buf 所指的内存空间,参数size 为buf 的空间大小

int pipe(int fields[2]);//同上,field[0]是读操作符,field[1]是写操作符,实现管道
int dup(int odlfd,int newfd);//输入输出重定向

memset(void *s, int ch, size_t n)//将s中前n个字节 (typedef unsigned int size_t )用 ch 替换并返回 s
strcpy()
strncpy()
strcmp()
strcat()
strlen()
chdir(path)改变当前目录
View Code