Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Linux Ask!

Move cursor to the start of the line in your shell

Answer:

Assume you have typed a long command, how to move to the start of the line?

The answer is..

Ctrl + a

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 compress a directory to a zip file

Answer:

To compress a directory and all the files under this directory to a zip file, you can use

# zip -r output.zip directory

Echo without a newline at the end

Answer:

Normally when you use the echo command to print a string, it will append a newline at the end of the string. To skip the newline, you can try using the "-n" argument.

# echo -n "hello"

Perform AES256 encryption on a string using command

Answer:

To encrypt a string using AES256, you can use the openssl tool.

# echo -n 'apple' | openssl enc -aes256 -k password -nosalt -iv 0 -a -p

key=1F3870BE274F6C49B3E31A0C6728957F0628DEF3179C824405825F85F5527096
iv =00000000000000000000000000000000
PMcE/8RE+RLRlQWT5tlLWA==