How to upgrade a single package in Ubuntu
Answer:
To upgrade a single package, you just need to install the package again, e.g.
# sudo apt-get install nginx
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
How to upgrade a single package in Ubuntu
Answer:
To upgrade a single package, you just need to install the package again, e.g.
# sudo apt-get install nginx
How to disable IPv6 support in a Java program
Answer:
To completely turn off IPv6 support in Java, you can set the system property "java.net.preferIPv4Stack", e.g.
# java -Djava.net.preferIPv4Stack=true ...
How to get the hostname of a local machine using Java
Answer:
The following codes illtsraeted how to get the hostname of the local machine using Java.
import java.net.InetAddress;
public class Test {
public static void main(String[] args) {
try {
InetAddress addr = InetAddress.getLocalHost();
// Get hostname
String hostName = addr.getHostName();
System.out.println(hostName);
} catch (Exception e) {}
}
}
Split on specific characters on Bash Script's for loop
Answer:
If you want to Bash script's for loop to split on non white-space characters, you can change the IFS, e.g.
#!/bin/bash
IFS='-'
list="a-b-c-d-e"
for c in $list; do
echo $c
done
The above script will split on the character '-'
E.g.
# ./test.sh
a
b
c
d
e
How to uncompress a WAR file using command
Answer:
To un-compress a Java Web Archives file (*.war), you can use the command
# jar xvf my-app.war