上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 30 下一页

2017年10月25日

/dev/null简单入门

摘要: 2>&1 /dev/null 将标准输入输出全部丢弃(表示2的输出重定向等同于1) 2>filename 把错误信息保存到filename 2>/dev/null >/dev/null 把错误信息丢弃,并别把标准输出也丢弃 cat /dev/null >a.txt 直接把a.txt内容清空 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(156) 评论(0) 推荐(0)

linux30道运维面试题

摘要: 传送门https://zhangge.net/1986.html 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(145) 评论(0) 推荐(0)

xencenter创建快照和恢复快照

摘要: 创建快照 恢复快照 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(1102) 评论(0) 推荐(0)

Xencenter如何安装Centos7虚拟机系统

摘要: xencenter的ip地址192.168.245.134(win10系统) 首先我们在win10系统安装好xencenter(这个软件可以直接在xenserver启动后,通过访问xenserver的ip,里面会有xencenter的安装包) 例如我们需要在在xenserver里面安装一个cento 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(2148) 评论(0) 推荐(0)

linux后台运行之&和nohup区别,模拟后台守护进程

摘要: 先来看一下&的使用 root@BP:~# cat test.sh #!/bin/bash while true do echo "linux">/dev/null done root@BP:~# ./test.sh & #&后台运行 [1] 4599 root@BP:~# ps #test.sh运行 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(668) 评论(0) 推荐(0)

linux磁盘检测和修复

摘要: 显示磁盘和闪存的信息,以及分区信息 [root@bogon shell]# fdisk -l Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sect 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(407) 评论(0) 推荐(0)

写一个脚本简单检测局域网存活的机器

摘要: [root@bogon shell]# cat b.sh #!/bin/bash ip=1 while [ $ip -lt 255 ] do ping -c 4 192.168.1.$ip 2>&1 >/dev/null #注意-c 4,在linux下,ping命令会一直发送ping请求,所以规定发 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(218) 评论(0) 推荐(0)

CentOS7.1 KVM虚拟化之环境准备

摘要: 备注:实验没有问题,只是暂时还不知道弄这个用来干嘛,不过先留着以后查看吧 一、基础平台 1.一台装有VMware的Windows系统 (可联网) 2.CentOS7.1 64bit 镜像 二、最小化安装一台CentOS 7.1系统的VMware虚拟机"CentOS KVM01" 要求:内存4G、硬盘 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(592) 评论(0) 推荐(0)

linux内核编程helloworld(中级)

摘要: 传入参数 [root@bogon modules]# cat first.c #include<linux/kernel.h> #include<linux/stat.h> #include<linux/moduleparam.h> #include<linux/init.h> #include<l 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(113) 评论(0) 推荐(0)

Linux内核模块编程之Helloworld(初级)

摘要: 注意printk那里,KERN_ALERT和打印消息之间是没有逗号的,搞得劳资查了半天才发现一直没有提示信息的原因 #include <linux/init.h> #include <linux/module.h> MODULE_LICENSE("Dual BSD/GPL");//MODULE_LI 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(398) 评论(0) 推荐(0)

linux系统调用的三种方法

摘要: 通过glibc提供的库函数 [23:02:14] gcc chmodtest.c [23:02:17] ls -l kali //记得先创建这个文件 -rwxrwxrwx. 1 root root 0 May 10 22:56 kali [23:02:25] ./a.out chmod succee 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(225) 评论(0) 推荐(0)

execve函数的介绍与使用

摘要: #include<stdio.h> #include<unistd.h> int main() { char *filename[]={"./BP",NULL};//BP是c文件编译链接后产生的可执行文件,目的是打印一条语句 char *envp[]={0,NULL};//如果依赖于新环境变量,这里 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(3135) 评论(0) 推荐(0)

进程间通信——共享内存

摘要: //shmdata.h //test if define #ifndef _SHMDATA_H_HEADER #define _SHMDATA_H_HEADER #define TEXT_SIZE 100 struct shared_use_set { int readed;//为1时可写入,为0时 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(163) 评论(0) 推荐(0)

进程间通信——管道通信

摘要: pipe管道通信 #include<stdio.h> #include<stdlib.h> #include<string.h> #include<unistd.h> #include<sys/types.h> int main(){ pid_t childpid; int fd[2]; pipe( 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(149) 评论(0) 推荐(0)

网络编程

摘要: 客户端代码如下 #include<stdio.h> #include<string.h> #include<stdlib.h> #include<unistd.h> #include<sys/stat.h> #include<arpa/inet.h> #include<sys/socket.h> i 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(118) 评论(0) 推荐(0)

进程

摘要: 设置环境变量 getenv(string)获得环境变量 putenv(string)该stringj需要带=号 setenv(name,values,int overwrite)如果环境变量已存在,且overwirte为0,则始终不改变环境,否则永远改变环境 unsetenv(name)移除name 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(91) 评论(0) 推荐(0)

C语言函数指针的使用

摘要: 使用函数指针时一定要注意,因为c不会检查参数是否正确 区分返回指针的函数和函数指针 int *f4();返回一个整数指针 int (*f5)();返回整数的函数指针 int * (*f6)();返回整数指针的函数指针 传递函数指针例子 #include<stdio.h> int add(int a, 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(151) 评论(0) 推荐(0)

多线程

摘要: 以下两个程序交替运行,编译时gcc -o thread1 thread1.c -lpthread ,如果需要传入一个参数,只需要在创建线程时把第四个参数改为传入的参数就可以了,NULL改为null不能编译通过,pthread_join使一个线程等待另一个线程结束,因为sleep所以运行一秒就停下等待 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(94) 评论(0) 推荐(0)

C语言文件操作

摘要: 下列代码创建一个a.txt文件,权限777,fp为返回码 #include<stdio.h> #include<fcntl.h> int main(){ int fp; fp=open("a.txt",O_CREAT,777); printf("%d\n",fp); close(fp); retur 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(224) 评论(0) 推荐(0)

c的动态内存管理

摘要: 在linux系统下使用malloc提示警告,解决方法,加入头文件<stdlib.h> 首先来个基本的例子 int *p=(int *)malloc(sizeof(int));(当malloc无法分配内存时会返回null,所以在使用它返回的指针前最好先检查null是否为空,如果不为空再使用p指针) * 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(120) 评论(0) 推荐(0)

上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 30 下一页

导航