1. Command Console
1) Linux/unix command format
command [-Options ...] [Parameters ...]
such as: ls-a ~
mkdir. Demo//Create hidden directory
Ls
Ls-a
2) Standard output: is the default output on the console (terminal, command line)
The default output of the LS pwd cat and other commands is standard output
">" Output redirection, you can redirect the standard output to a file.
such as: ls > abc.txt//The default standard output of LS is directed to Abc.txt
Cat Abc.txt//view Abc.txt file contents
3) "|" is a pipe symbol, you can connect two commands, the previous command
Output as input to the latter command
4) grep is filtering the input information leaving the specified line
2. Directory and file operations
1) CD changes the current working directory
Default CD equivalent to CD ~: Return to "home directory"
. Represents the current directory
.. Represents a parent directory
~ represents "Home Directory"
Directory path starting with "/": Absolute path, Reverse: relative path
Relative path: Is relative to the current directory. ".", ".." Are relative paths
Files/directories that begin with "." Are hidden
2) LS column directory command
Such as:
LS/
Ls/etc
Ls/opt
LS ~
LS Workspace
LS-A ~ Show all content (including hidden files and directories)
3) Create a directory
mkdir. Photo Create hidden folder ". Photo"
4) MV Move/Rename folder/File move
mv. Photo Photo//renaming
mkdir mm
mv mm Photo//Mobile
LS photo
MV passwd Passwd.bak
5) RM Delete File/directory
Delete File: RM file1 file2 file3 ...
Delete directory: Rm-rf dir1 dir2 ...
Option:-R recursively delete all subdirectories and files
-F Force Delete without any interaction acknowledgement (Linux Default-F)
6) CP Copy File/directory, note the second parameter
Copying Files cp/etc/passwd ~
Assignment Folder Cp-r Workspace Workspace.bak
mkdir Demo
Cp-r Workspace Demo
Option-R means recursive assignment of all subdirectories and file contents
7) Authorization of the document
Ls-al Viewing long format results
D rwx rwx rwx liucs liucs com
-RWXRWX---liucs liucs hi.java
chmod 660 Test.txt
rw-rw----
Rwx
421 421
0---
001 1--x
010 2-w-
011 3-WX
4 r--
101 5 R-x
6 rw-
111 7 rwx
8) Windows command
dir = = ls
mkdir = = mkdir
cd = = CD
del = RM
CLS = Clear
more = more
Type = = Cat
move = MV
Copy, xcopy = CP
Help = Mans
3. Creation and modification of files
1) Echo echoing command
ECHO ABC echoes ABC back to console
2) ">" Output redirect, redirect the "standard output" result of the command to
The new goal.
">>" means append output
LS/>rootlist.txt
Echo Abc>test.txt
Echo Abc>>test.txt
3) Cat View file contents
4) Touch Create new blank file, modify file access time
4. Create and modify a text file VI
1 open VI [filename], command state
Command status: Any keyboard input is a command
Command state: [ESC] always returns to the command state
Edit state: Edits the text, any input is the edit content
VI [filename], I o a
Command-line command status edit state
<-: Q Exit command <-[ESC]
<-: q! Force quit command
<-: Wq Save Exit command
: W Save
: w [filename]
: w! [FileName]
/ ? N Find
5. Package backup and restore (equivalent to winrar)
1) Tar Packaging:
TAR-CF Workspace.tar Workspace ....
Gzip Workspace.tar
Or:
Tar-czf workspace.tar.gz Workspace ....
To release the current folder:
Tar-xzf workspace.tar.gz (Linux)
Or:
Gzip-d workspace.tar.gz
TAR-XF Workspace.tar
2) Zip package and release:
Zip-r file.zip file1 file2 file3 ...
Unzip File.zip
6. System environment variable Path
1) environment variable path: The search path of the operating system executable command.
2) You can use $path to reference the value of a variable.
3) View environment variables: Echo $PATH
4) Set Environment variables: Export path= $PATH:/sbin
7. Installation of Java and configuration of the environment
1) Oracle download JDK, http://java.sun.com
Linux version of JDK is self-releasing compressed package
2) Install JDK with Java1.5 as an example:
chmod +x Jdk-1_5_0_09-linux-i586.bin (increased executive authorization)
./jdk-1_5_0_09-linux-i586.bin (Perform release)
Auto-release installation to ~/jdk1.5.0_09
3) Configure the JDK to install the JDK to/OPT/JDK as an example:
/opt/jdk
|-Bin development tool (command: Javac, Java, jar, rmic, JPS ...)
|-Lib development tool implementation class Tools.jar
|-JRE (Java Runtime Environment)
| |-Bin (JVM)
| |-Lib (Java API class library)
| |-Rt.jar (core class library, zip compression,
| Include Java.util.Random)
|-src.zip (source file for Java API class library)
A Configure the path to include the bin directory in the JDK installation directory
Purpose: Extend the development tools (commands) brought by the JDK to the OS.
such as: Export Path=/opt/jdk/bin: $PATH
B configuration Java_home, Java_home point to the JDK's installation directory
The role of Java_home: to guide "some Java software" to find the JDK
For example, the Tomcat server uses Java_home
Example: Export JAVA_HOME=/OPT/JDK
C configuration classpath, which points to the Java class's deployment directory or jar file
Used to indicate the Java class's search path for the JVM, when Java executes the class
Locate the class file under the path indicated by Classpath.
Example: Export classpath=.
Windows Reference java Configuration command:
Set Java_home=c:\program files\java\jdk1.6.0_01
Set classpath=.
Set Path=c:\program files\java\jdk1.6.0_01\bin;%path%
8. Package and CLASSPATH:
1) is the classification of classes in Java
2) package mapped to the system's folder
3) Full name of the Java class: Fully qualified name = Package name + class name
4) specify "fully qualified name" When using Java execution class
5) Examples of editing and compiling Java:
CD Demo
VI Helloworld.java (Edit) Java source file)
mkdir bin (Create output directory bin)
Javac-d bin Helloworld.java (Compile (Compile) source text
To the Bin folder to generate the package in the bin)
(The Java class file search path is set below and Java execution takes advantage of this
Path search for Java packages and class files)
Export Classpath=/home/liucs/demo/bin
Java Corejava.day01.HelloWorld (Execute Java class, Java command will
Find the package Corejava.day01 in the series path specified by Classpath
Find the Helloworld.class in the package)
9. System Initialization Scripts
1) Init scripts are system script files that are automatically executed during the boot process
Typically used to initialize the system environment
2) System-level initialization script file:/etc/profile for all current system users
Execute at login time
Command Console and Java environment configuration