易截截图软件、单文件、免安装、纯绿色、仅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) {
}


相关文档:

mysql 将表中数据导出 (linux)

今天遇到要导出数据库中表的数据。下面这个就可以搞定。。
#导出指定的表 #导出命令 -u用户名 -p密码 -h主机IP地址 数据库名 表名1 表名2 > 导出文件.sql
mysqldump -uroot -proot -h192.168.0.88 ok_db oktable1 oktable2 > ok_db.sql
另外在更改mysql密码时候,网上有些命令不对:
我用如下:set password=pas ......

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

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

linux iscsi initiator 工具

open-iscsi:http://www.open-iscsi.org/
iscsi 软件的评价
至于软件表现的强弱如何?此可透过实际的CPU 运算占用(占用百分比愈低愈好)、I/O 传输表现(每秒完成多少个I/O 处理,即IOPS)来评断,另外要重视支持的GbE 层级、错误修正层级,如10GbE 优于1GbE,以及ERL2 优于ERL1 优于ERL0。以及是否支持MPIO,MPIO 指的是一部 ......

linux mount 与umount 学习心得

要将文件系统挂载到我们的 Linux 系统上,
就要使用 mount 这个指令
用法:
mount [-tonL]  装置名称代号  挂载点
mount -a
参数:
-a  :依照 /etc/fstab 的内容将所有相关的磁盘都挂上来!
-n  :一般来说,当我们挂载文件系统到 Linux 上头时, Linux 会主动的将
   &nbs ......

linux作业管理(ctrl+z,fg,jobs,kill等)

作业管理
1.将“当前”作业放到后台“暂停”:ctrl+z
2.观察当前后台作业状态:jobs
参数:
-l 除了列出作业号之外同时列出PID  
-r:列出仅在后台运行(run)的作业
-s:仅列出暂停的作业
3.将后台作业拿到前台处理:fg
fg %jobnumber (%可有可无)
4.让作业在后台运行:bg
ctrl ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号