Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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²Ù×÷ϵͳ


Ðí¶à¸Õ½Ó´¥LinuxµÄÍøÂç¹ÜÀíÔ±·¢ÏÖ£¬ËûÃǺÜÄÑÓÉÖ¸Ïòµã»÷ʽµÄ°²È«ÅäÖýçÃæ×ª»»µ½ÁíÒ»ÖÖ»ùÓڱ༭¸´ÔÓ¶øÄÑÒÔ×½ÃþµÄÎı¾ÎļþµÄ½çÃæ¡£±¾ÎÄÁгöÆßÌõ¹ÜÀíÔ±Äܹ»Ò²Ó¦¸Ã¿ÉÒÔ×öµ½µÄ²½Ö裬´Ó¶ø°ïÖúËûÃǽ¨Á¢¸ü¼Ó°²È«µÄLinux·þÎñÆ÷£¬²¢ÏÔÖø½µµÍËûÃÇËùÃæÁٵķçÏÕ¡£
ÇëÈκδóÐÍ»ú¹¹µÄÍøÂç¹ÜÀíÔ±¶ÔLinuxºÍÍøÂç²Ù×÷ϵͳ£¨ÈçWindows NT»òNo ......

LinuxÏÂÎļþºÍĿ¼µÄÑÕÉ«´ú±íµÄº¬Òå[ת]

Ô­ÎĵØÖ·
À¶É«±íʾĿ¼£»
ÂÌÉ«±íʾ¿ÉÖ´ÐÐÎļþ£»
ºìÉ«±íʾѹËõÎļþ£»
dzÀ¶É«±íʾÁ´½ÓÎļþ£»
»ÒÉ«±íʾÆäËüÎļþ£»
ºìÉ«ÉÁ˸±íʾÁ´½ÓµÄÎļþÓÐÎÊÌâÁË£»
»ÆÉ«ÊÇÉ豸Îļþ£¬°üÀ¨block, char, fifo¡£
ÓÃdircolors
-p¿´µ½È±Ê¡µÄÑÕÉ«ÉèÖ㬰üÀ¨¸÷ÖÖÑÕÉ«ºÍ“´ÖÌ唣¬Ï»®Ïߣ¬ÉÁ˸µÈ¶¨Òå¡£ ......

Oracle 11g R1 for Linux(RHEL5)°²×°

1 ¡¢°²×°Ç°µÄ×¼±¸
1.1 ¼ì²éÓ²¼þ
ÎïÀíÄڴ棺 # grep MemTotal /proc/meminfo
½»»»¿Õ¼ä£º # grep SwapTotal /proc/meminfo
½»»»¿Õ¼äµÄ´óСÊǸù¾ÝÎïÀíÄÚ´æµÄ´óСÀ´ÉèÖõģ¬ÎïÀíÄÚ´æÉÙÓÚ 2G µÄÔò½»»»¿Õ¼äÉèΪÎïÀíÄÚ´æµÄÁ½±¶£¬ÎïÀíÄÚ´æ´óÓÚ 2G µÄÔò½»»»¿Õ¼äºÍÎïÀíÄÚ´æ´óСһÑù¡£Èç¹û²»·ûºÏÉÏÊö¹æ¶¨£¬ÄÇô¾ÍÐèÒªÖØÐÂÉèÖý ......

linux×÷Òµ¹ÜÀí£¨ctrl+z,fg,jobs,killµÈ£©

×÷Òµ¹ÜÀí
1.½«“µ±Ç°”×÷Òµ·Åµ½ºǫ́“ÔÝÍ£”£ºctrl+z
2.¹Û²ìµ±Ç°ºǫ́×÷ҵ״̬£ºjobs
²ÎÊý£º
-l ³ýÁËÁгö×÷ÒµºÅÖ®ÍâͬʱÁгöPID  
-r£ºÁгö½öÔÚºǫ́ÔËÐУ¨run£©µÄ×÷Òµ
-s£º½öÁгöÔÝÍ£µÄ×÷Òµ
3.½«ºǫ́×÷ÒµÄõ½Ç°Ì¨´¦Àí£ºfg
fg %jobnumber (%¿ÉÓпÉÎÞ)
4.ÈÃ×÷ÒµÔÚºǫ́ÔËÐУºbg
ctrl ......

Ô¶³ÌÁ¬½Ó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ºÅ