Many industrial Java applications are developed om a WIN32 platfor, but run on a target platform, which is Unix based. If you are a beginner to Unix, and would like to work on an emulator that runs on a Win32 platform, this post is for you. MobaXterm is a set of Unix commands (GNU/Cygwin) included in a single portable exe file. MobaXterm integrates an X server and several network clients (SSH, RDP, VNC, telnet, rlogin, sftp, ftp, ...) accessible through a tab-based terminal.
Step 1: Download MobaXterm from http://mobaxterm.mobatek.net/ for a personal use, that is learning to use Unix. Get the portable edition. This is zip file and extract the MobaXterm_Personal_
Step 2: Now, you can change to your C drive in Win32. One of two ways as shown below:
1. cd /drives/c
2. cd /cygdrive/c
Step 3: You can now use this to practice the Unix posts from this and other blogs or books to enhance your Unix skills.
If you already had set up JAVA_HOME environment variable, you can echo it as shown below
echo $JAVA_HOME
If you want to set up the environment variables
export JAVA_HOME=/drives/c/FAST/JDK/1.6.0.31
export M3_HOME=/drives/c/FAST/apache-maven-3.0.4
Note: MobaXterm allows you to add number of other plugins from their web site like ksh shell, etc. All you have to do is download the plugin from the plugins tab in their website into your folder where the exe file is. Also be aware that Unix does not have the carriage return characters ( use dos2unix to convert dos files to Unix files) and also Unix files can't have spaces in between their names.
Step 4: You can set up setenv.sh bash script to set up your Java environment as shown below
#!/bin/shStep 5: you can run the above script as
JAVA_HOME=/drives/c/FAST/JDK/1.6.0.31
export JAVA_HOME
M3_HOME=/drives/c/FAST/apache-maven-3.0.4
export M3_HOME
sh setenv.sh
For running in debug mode use -x
sh -x setenv.sh
Step 6: In Unix, you can use the Vi editor as your editor, and MobaXterm comes with VIM (Vi IMproved) editor.
vi test.txt
Step 7:You can query the current directory as shown below
pwd
and query the files and folders in it as
ls -ltr
Practice what ever commands you like to learn like
hostname
whoami
date
Note:
- Unix systems have no central place like the Windows registry for storing configuration information. Instead, Unix configuration is spread over a fair number of different files. Many of these files live in a directory called /etc : the list of users is in a file called /etc/passwd, while the name of the machine is typically found in /etc/host.
- On Unix machines, programs cannot use network ports less than 1024. Only the special root user can use these ports.
- There is no file locking in Unix, so you can delete the file while it is executing, and it will continue to exist as long as some process (Which previously opened it) has an open handle for it. The directory entry for the file is removed when you delete it, so it cannot be opened any more, but processes already using this file can still use it. Once all processes using this file terminate, the file is deleted automatically.