易截截图软件、单文件、免安装、纯绿色、仅160KB

Java调用Linux命令行若干实例

 Executing a CommandSee also e90 Reading Output from a Command.
try {
// Execute a command without arguments
String command = "ls";
Process child = Runtime.getRuntime().exec(command);

// Execute a command with an argument
command = "ls /tmp";
child = Runtime.getRuntime().exec(command);
} catch (IOException e) {
}
If an argument contain spaces, it is necessary to use the overload that requires the command and its arguments to be supplied in an array:
try {
// Execute a command with an argument that contains a space
String[] commands = new String[]{"grep", "hello world", "/tmp/f.txt"};
commands = new String[]{"grep", "hello world", "c:\\Documents and Settings\\f.txt"};
Process child = Runtime.getRuntime().exec(commands);
} catch (IOException e) {
}
e90. Reading Output from a Commandtry {
// Execute command
String command = "ls";
Process child = Runtime.getRuntime().exec(command);

// Get the input stream and read from it
InputStream in = child.getInputStream();
int c;
while ((c = in.read()) != -1) {
process((char)c);
}
in.close();
} catch (IOException e) {
}

e91. Sending Input to a Commandtry {
// Execute command
String command = "cat";
Process child = Runtime.getRuntime().exec(command);

// Get output stream to write from it
OutputStream out = child.getOutputStream();

out.write("some text".getBytes());
out.close();
} catch (IOException e) {
}


相关文档:

linux 驱动mmap操作


三、VMA和PAGE结构 和mmap函数
 
1.page  主要成员
   atomic_t count; 
//这个页的引用数. 当这个 count 掉到 0, 这页被返回给空闲列表.
void *virtual; 
//如果页被映射,则表示这页的内核虚拟地址; 否则, NULL.
unsigned long flags; 
//描述页状态的一套位标志. 这些包括 ......

Linux/Unix下各种压缩文件的压缩/解压方法

1. gz文件
这种文件可以使用gzip、gunzip、zcat进行解压:
gzip -d file_name
gunzip -d file_name
zcat file_name
2. tar.gz、tgz文件
这种压缩文件使用解压命令和tar命令配合使用,如:
gzip -d file_name.tar.gz
gunzip -d file_name.tgz
zcat file_name
然后执行:
tar xvf file_name.tar
某些版本的t ......

Linux下文件和目录的颜色代表的含义[转]

原文地址
蓝色表示目录;
绿色表示可执行文件;
红色表示压缩文件;
浅蓝色表示链接文件;
灰色表示其它文件;
红色闪烁表示链接的文件有问题了;
黄色是设备文件,包括block, char, fifo。
用dircolors
-p看到缺省的颜色设置,包括各种颜色和“粗体”,下划线,闪烁等定义。 ......

linux下安装jdk

2.设置环境变量。
#vi /etc/profile
在最后面加入
#set java environment
export JAVA_HOME=/usr/java/jdk-1_5_0_02
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
:$JAVA_HOME/lib/mysql-connector-java-3.2.0.jar:$JAVA_HOME/lib/classes12.jar
export PATH=$PATH:$JAVA_ ......

linux下apache+php安装常见问题

1、Apache
  在如下页面下载apache的for Linux 的源码包
  http://www.apache.org/dist/httpd/;
  存至/home/xx目录,xx是自建文件夹,我建了一个wj的文件夹。
  命令列表:
  
cd /home/wj
  tar -zxvf httpd-2.0.54.tar.gz
  mv httpd-2.0.54 apache
  cd apache
  ./configure --prefix=/u ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号