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) {
}
Ïà¹ØÎĵµ£º
Èý¡¢VMAºÍPAGE½á¹¹ ºÍmmapº¯Êý
1.page Ö÷Òª³ÉÔ±
atomic_t count;
//Õâ¸öÒ³µÄÒýÓÃÊý. µ±Õâ¸ö count µôµ½ 0, ÕâÒ³±»·µ»Ø¸ø¿ÕÏÐÁбí.
void *virtual;
//Èç¹ûÒ³±»Ó³É䣬Ôò±íʾÕâÒ³µÄÄÚºËÐéÄâµØÖ·; ·ñÔò, NULL.
unsigned long flags;
//ÃèÊöҳ״̬µÄÒ»Ì×λ±êÖ¾. ÕâЩ°üÀ¨ ......
IPµØÖ·ÊÇÒ»¸ö32λµÄ¶þ½øÖÆÊý£¬ËüÓɵã·ÖÊ®½øÖƼǷ¨±íʾ£¬Ã¿Ò»¸öÊ®½øÖÆÊý´ú±íÒ»¸ö8λÎÞ·ûºÅÕûÐÍÊý£¬ËùÒÔ·¶Î§ÔÚ0-255Ö®¼ä¡£
Ò»¸öIPµØÖ··ÖÎªÍøÂçµØÖ·ºÍÖ÷»úµØÖ·£¬ÍøÂçµØÖ·Çø·Ö²»Í¬ÍøÂ磬Ö÷»úµØÖ·Çø·ÖÏàÍ¬ÍøÂçÖв»Í¬Ö÷»ú¡£²»Í¬µÄIPµØÖ·ÀàËûÃǵÄÖ÷»úÍøÂçµØÖ·Ò²ÊDz»¹Ì¶¨µÄ£¬A,B,CÀàµØÖ·¶¨ÒåÁËijһÖ÷»úÌØ¶¨µÄIPµØÖ·£ ......
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 ......
°²×°OpenSSH
UbuntuȱʡûÓа²×°SSH Server£¬Ê¹ÓÃÒÔÏÂÃüÁî°²×°£º
sudo apt-get install openssh-server openssh-client
²»¹ýUbuntuȱʡÒѾ°²×°ÁËssh client¡£
ÅäÖÃÍê³ÉºóÖØÆð£º
sudo /etc/init.d/ssh restart
windows ¿Í»§¶ËÓÃputtyÁ¬½ÓÃüÁîshellģʽ ......