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µÄÍøÂç¹ÜÀíÔ±·¢ÏÖ£¬ËûÃǺÜÄÑÓÉÖ¸Ïòµã»÷ʽµÄ°²È«ÅäÖýçÃæ×ª»»µ½ÁíÒ»ÖÖ»ùÓڱ༸´ÔÓ¶øÄÑÒÔ×½ÃþµÄÎı¾ÎļþµÄ½çÃæ¡£±¾ÎÄÁгöÆßÌõ¹ÜÀíÔ±Äܹ»Ò²Ó¦¸Ã¿ÉÒÔ×öµ½µÄ²½Ö裬´Ó¶ø°ïÖúËûÃǽ¨Á¢¸ü¼Ó°²È«µÄLinux·þÎñÆ÷£¬²¢ÏÔÖø½µµÍËûÃÇËùÃæÁٵķçÏÕ¡£
ÇëÈκδóÐÍ»ú¹¹µÄÍøÂç¹ÜÀíÔ±¶ÔLinuxºÍÍøÂç²Ù×÷ϵͳ£¨ÈçWindows NT»òNo ......
LINUXµ÷ÓÅ·½·¨×ܽá
----------------------------------------------------------------------------------------------------------------------------
´ó¶àÊý Linux ·¢²¼°æ¶¼¶¨ÒåÁËÊʵ±µÄ»º³åÇøºÍÆäËû Transmission Control Protocol£¨TCP£©²ÎÊý¡£¿ÉÒÔÐÞ¸ÄÕâЩ²ÎÊýÀ´·ÖÅä¸ü¶àµÄÄڴ棬´Ó¶ø¸Ä½øÍøÂçÐÔÄÜ¡£ÉèÖÃÄں˲ÎÊýµÄ· ......
Òª½«Îļþϵͳ¹ÒÔØµ½ÎÒÃÇµÄ Linux ϵͳÉÏ£¬
¾ÍҪʹÓà mount Õâ¸öÖ¸Áî
Ó÷¨:
mount [-tonL] ×°ÖÃÃû³Æ´úºÅ ¹ÒÔØµã
mount -a
²ÎÊý£º
-a £ºÒÀÕÕ /etc/fstab µÄÄÚÈݽ«ËùÓÐÏà¹ØµÄ´ÅÅ̶¼¹ÒÉÏÀ´£¡
-n £ºÒ»°ãÀ´Ëµ£¬µ±ÎÒÃǹÒÔØÎļþϵͳµ½ Linux ÉÏͷʱ£¬ Linux »áÖ÷¶¯µÄ½«
&nbs ......
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 ......
DBA£ºLinux
ÃæÏò DBA µÄ Linux Shell ½Å±¾¼ò½é
×÷ÕߣºCasimir Saternos
ѧϰһЩÔÚ Linux Éϰ²×°¡¢ÔËÐкÍά»¤ Oracle Êý¾Ý¿âËùÐèµÄ»ù±¾ bash shell ½Å±¾¡£
±¾ÎÄÏà¹ØÏÂÔØ£º
ʾÀý½Å±¾
Oracle Êý¾Ý¿â 10g
2005 Äê 11 Ô·¢±í
´óÔ¼ 7 Äêǰ£¬Oracle ·¢²¼ÁË Linux ÉϵĵÚÒ»¸öÉÌÒµÊý¾Ý¿â¡£´ÓÄÇʱÆð£¬Oracle¡¢Red Hat ºÍ ......