UNIX - 技术教程文章

Unix Commands

Unix CommandsCommand Examplepwd Displays the current directoryls List the current directory -l : Include file details-a : Include hidden files-F: show directoriesrm Remove a filemkdir Create a new directoryrmdir Remove a directory Or rm -r if the directory is not empty.cd Change current directorycp Copy a file cp souce destinationmv Move or rename a file mv hello.c newname.ccat Display the content...

(unix domain socket)使用udp发送>=128K的消息会报ENOBUFS的错误【代码】【图】

1、Unix domain socket简介unix域协议并不是一个实际的协议族,而是在单个主机上执行客户/服务器通信的一种方法,所用API于在不同主机上执行客户/服务器通信所有的API(套接字API,如AF_INET、AF_INET6等类型的API)相同。unix域协议可以视为是进程之间本地通信IPC的一种。unix域提供两类套接口:字节流套接口(类似TCP)和数据报套接口(类似UDP)。使用Unix域套接口的理由有三:Unix域套接口往往比位于同一主机的TCP套接口快出一...

lunix 下安装maven

方法一: yum install maven 直接自动安装了maven 然后自行配置 /etc/maven/setting 文件就好 使用阿里云的中心仓库,相对速度较好 修改 <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> 方法二: 1->2->3->4 (下载文件步骤省略) 5、解压压缩包, 6、配置变量,输入命令:v...

lunix下find命令使用【代码】

列出当前目录及子目录下所有文件和文件夹 find . 在/home目录下查找以.txt结尾的文件名 find /home -name "*.txt" 同上,但忽略大小写 find /home -iname "*.txt" 当前目录及子目录下查找所有以.txt和.pdf结尾的文件 find . \( -name "*.txt" -o -name "*.pdf" \)或find . -name "*.txt" -o -name "*.pdf" 匹配文件路径或者文件 find /usr/ -path "*local*" 基于正则表达式匹配文件路径 find . -regex ".*\(\.txt\|\.pdf\)$" 同上,...

Unix系统中如何将stdin定向到文件【图】

1.方法1:close then open 第一步是close(0),即将标准输入的连接挂断,这里调用close(0)将标准输入与终端设备的连接切断,切断后当前文件描述符数组中的第一个元素现在处于空闲状态。 最后,使用open(filename,O_RDONLY)打开一个想连接到stdin上的文件。当前的最低可用文件描述符是0,因此所打开的文件被连接到标准输入上去。 #include <stdio.h>#include <fcntl.h>#include <unistd.h>#include <stdlib.h> main(){int fd; char...

如何使用Unix提供的间隔时钟器?(tricker_demo)【图】

/ * ticker_demo.c *演示了使用间隔计时器来生成reqular *信号,这些信号又被捕获并用于倒计时 * / #include <stdio.h>#include <sys/time.h>#include <signal.h> int main(){ void countdown(int);signal(SIGALRM,countdown); if(set_ticker(500)==-1) perror("set_ticker"); else while(1) pause(); return 0;} void countdown(int signum){ static int num=10; printf("%d..",num--); fflush(stdout); if(num<0){...