- 打开一个终端:
- ywx@ywx:~/desktop$ cat hello.c
-
#include <stdio.h>
-
#include <wait.h>
-
-
int main()
-
{
-
int i=0;
-
for(i=0;i<100;i++)
-
{
-
printf("hello world\n");
-
sleep(2);
-
}
-
return 0;
-
}
-
ywx@ywx:~/desktop$ gcc hello.c -o hello
-
ywx@ywx:~/desktop$ ./hello one two
-
hello world
-
hello world
打开另一个终端,查看当前进程的进程号:得知进程号为
ywx@ywx:~/Desktop$ ps -A | grep hello
2752 pts/0 00:00:00 hello
然后进入/proc/2752进程下面:
ywx@ywx:~/Desktop$ cd /proc/2752
ywx@ywx:/proc/2752$ cat cmdline
./helloonetwoywx@ywx:/proc/2752$