Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ÅäÖÃjava¿ª·¢Æ½Ì¨

LinuxÅäÖÃjava¿ª·¢Æ½Ì¨
Ò»¡¢°²×°jdk
1.ÏÂÔØ°²×°jdk
£¨1£©¡¢Ê×ÏÈ£¬ÔÚhttp://java.sun.com
ÕÒµ½ÒªÏÂÔØµÄjdk£¬ÏÂÔØ×Ô¼ºÐèÒªµÄjdk°æ±¾¡£ÎÒÕâÀïʹÓõÄÊÇjdk6£¬µÃµ½µÄÊÇÒ»¸öÃûΪjdk-6u6-linux-i586-rpm.binµÄÎļþ¡£´ËÎļþµ±Ç°Îª²»¿ÉÔËÐеÄshell script¡£
£¨2£©¡¢¸ü¸ÄȨÏÞ£¬ÌáÈ¡jdk°²×°Îļþ£º
   ´ò¿ªÖÕ¶ËÔËÐ ......

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¿ªÆôSSH

#pacman -S openssh #°²×°openssh
°²×°Íê³ÉºóÔÚ/etc/rc.confµÄ×îµ×²¿DAEMONSºóÌí¼ÓsshdÈÃϵͳÆô¶¯Ê±×Ô¶¯Æô¶¯openssh
DAEMONS=(syslog-ng network netfs crond sshd)
Ò²¿ÉÊÖ¶¯Æô¶¯openssl,Ö´ÐÐ
#/etc/inin.d/sshd start
ĬÈÏÇé¿öÏÂÆäËüµçÄÔÊDz»ÄÜͨ¹ýsshÀ´·ÃÎÊarchlinuxµÄ,ÐèÒªÐÞ¸ÄÁ½¸öÎļþÀ´ÊµÏÖ:
/etc/h ......

Ô¶³ÌÁ¬½ÓLinux £¨UbuntuÅäÖÃSSH·þÎñ£© ¶Ë¿Ú22

°²×°OpenSSH
UbuntuȱʡûÓа²×°SSH Server£¬Ê¹ÓÃÒÔÏÂÃüÁî°²×°£º
sudo apt-get install openssh-server openssh-client
²»¹ýUbuntuȱʡÒѾ­°²×°ÁËssh client¡£
ÅäÖÃÍê³ÉºóÖØÆð£º
sudo /etc/init.d/ssh restart
windows ¿Í»§¶ËÓÃputtyÁ¬½ÓÃüÁîshellģʽ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ