1. Shutdown-h now shuts down
2. Shutdown-r now restart the computer
3. Reboot restart the computer
4. Su-Switch to root user
5. Logout User logoff
6. LS Display file
7. Ls-l (is the letter, not the number 1) to display the file (a little detail)
2 Developing a Java program in Linux with VI Editor
1. VI Hell.java
2. Input I (enter insert mode)
3. After writing the program, press ESC (enter command mode)
4. Enter:
5. Enter Wq (means save exit) q! (indicates exit does not save)
6. Compiling Javac Hell.java
7. Running Java Hell
3 creation of files and folders
mkdir Linux (Create a Linux folder, Linux is strictly case sensitive)
Touch Linux.txt (Create a linux.txt file, Linux is strictly case sensitive)
.. Represents a top-level directory that can be used multiple times
. Represents the current directory
Ls-la (is a letter, not a number 1) shows hidden files and directories (starting with.)
Hide the directory or file name to begin with.
4 Home Directory
The root user's home directory is/root, and the input prompt is #
Normal user's directory is/home/userx, the input prompt is $
5 Bin Directory
Common executable files
/bin,/usr/bin,/sbin, etc.
6 External Device Mountpoint
/media,/mnt
Mount points are automatically generated when device access is detected
7/ETC directory, System configuration file
8/tmp Directory, temp file
9/boot directory, System kernel and boot necessary files
10/dev directory, System-owned device files
11/USR Directory
USR is the UNIX system resource and abbreviation
Save the program's related files
12/lost+found
Each partition will be automatically created
13/var,/srv
14/proc
15/lib,/usr/lib,/usr/locat/lib
Delete File: RM file name
Delete matching files: Rm-rf file name [123]. File type, example: Rm-rf f[123].txt will remove F1.txt, f2.txt,f3.txt all
Command rules for directories and files
1 No more than 255 characters
2 Case-sensitive
File,file, file represents different files
3 All characters are legal except for/outside
Avoid using +-.* for the first character of the file name
Avoid using spaces, tabs and @#$%[] (), etc.
LS command operation
LS Ls[options][file_or_dirs]
LS, listing the contents of the current directory
LS/, displays the contents of the root directory
Ls-a, Show hidden files
Ls-l, Show details
Ls-ld, displaying the properties of the directory itself
LS--help, displays all commands for LS
Switch directories
CD, PWD
CD:, cd~, cd-
Copy files and directories, CP
CP [Options] File destination
CP [Options] file1 file2 destination
Cp-r dir1 dir2, copy directory
Cat
Cat [Options] Filenames
Pagination view text file, less
less [options] [filename]
Using PgUp, Pgdown page
User's information is stored in ETC/PASSWD
Store information such as user name, password and home directory
/etc/shadow (used to store passwords, equivalent to the password database)
Each user belongs to a group (equivalent to a role) and has a unique tag character gid
Group information is stored in the/etc/group
GID, membership, etc.
/etc/gshadow
The system associates a user with the same name and group for each user
Linux Permissions Categories
Read-only permission, denoted by R (read)
Can read the file or list the contents of the directory (LS)
Writable permission, denoted by W (write)
Can write, delete files or directories
Executable permissions, denoted by X (execute)
Executable files can be executed
Access to directory and switch to directory using CD
Without any permissions, use-to indicate
Set permissions for Linux files and directories
chmod [-r] Model file
Example: chmod o-w Perm Set Write permissions to other users (perm file)
U (owner), G (group), O (Other), A (UGO)
+-= (plus minus equals [permission]), rwx (Read and write execution)
Linux file compression instructions
gzip [-cdtv#] File name
Extension *.gz
-C: Output compressed data to the screen
-D: decompressed parameters
-T: File consistency check to see if corruption
-V: Shows the compression ratio compared to the original file
-#: Compression level, 1 fastest, 9 slowest, default is-6
bzip2 [-cdkzv#] File name
Extension *.bz2
-C: Output compressed data to the screen
-D: An uncompressed parameter that represents the decompression operation
-K: Keep the original file and do not delete the original file
-Z: A compressed parameter that represents a compression operation
-V: Shows the compression ratio compared to the original file
-#: Compression level, 1 fastest, 9 slowest, default is-6
Linux Switch-machine commands