Main content
Linux Installation
Common commands
Use of the VI editor
Telnet
Host name Settings
Settings for IP
Settings for the firewall
User and group account management
File Rights Management
RPM Package Management
Installation of software
Jdk,tomcat, Eclipse
Chapter One: Introduction to Linux
Linux is a free and open-source operating system with many different versions of Linux, but they all use the Linux kernel. Linux can be installed in a variety of computer hardware devices, such as mobile phones, tablets, routers, desktop computers
Linux Introduction
Linux appeared in 1991 and was jointly developed by Linus Torvalds, a student of the University of Helsinki, Finland, and later joined by many enthusiasts.
Linux Introduction
Linux appeared in 1991 and was jointly developed by Linus Torvalds, a student of the University of Helsinki, Finland, and later joined by many enthusiasts.
Linux Features
Multi-user, multi-tasking, rich network functions, reliable system security, good portability, standard compatibility, good user interface, excellent speed performance
Open source
Centos
Mainstream: The current Linux operating system is mainly used in production environments, mainstream enterprise Linux systems are still redhat or CentOS
Free: RedHat and CentOS are not very different, based on Red Hat Linux provides free use of the source code of the Enterprise CentOS is a Linux distribution version
Easy to update: the CentOS exclusive yum command supports online upgrades, updates the system instantly, and does not require money to purchase support services like Redhat!
CentOS 6.x
CentOS Website: http://www.centos.org/
CentOS Sohu Image: http://mirrors.sohu.com/centos/
CentOS NetEase Image: http://mirrors.163.com/centos/
CentOS Beijing Polytechnic University Image: http://mirror.bit.edu.cn/centos/
Chapter II: Linux Installation
Environment: Windows7, Oracle VirtualBox, CentOS6.7
Linux directory structure
Bin (binAries) storing binary executable files
Sbin (sUper UserbinARIES) store binary executable files, only root to access
ETC (etcEtera) storing system configuration files
USR (uNixsHaredResources) is used to store shared system resources
Home Store The root directory of user files
Root Super User Directory
Dev (DevICES) for storing device files
Lib (LibRary) the shared libraries and kernel modules required to run the program in the file system
MNT (mOuNTSystem administrator installs the temporary file system installation point
Boot holds various files used for system boot
TMP (TEMPOrary) for storing various temporary files
VAR (variable) for storing files that need to change data at run time
Chapter III: Linux common commands
Command format: command-option parameter
such as: LS-LA/USR
LS: Displays a list of files and directories (LIsT
Common parameters:
-L (Long)
-A (all) note hidden files, special directories. and.
-T (Time)
Classification of Linux commands
Internal command: Part of the shell parser
CD Switch directory (CHangeDirectory)
PWD Displays the current working directory (PRintWOrkingDirectory)
Help
External command: File program independent of Shell parser
LS displays a list of files and directories (LIst
mkdir Create a directory (mAkEdirEctoriy)
CP Copy files or directories (COPY
View Help documentation
Internal command: Help + command (Help CD)
External command: Man + command (man ls)
Manipulating files or directories common commands
PWD Displays the current working directory (PRintWOrkingDirectory)
Touch creates an empty file
mkdir Create a directory (mAkEdirEctoriy)
-P Parent Directory does not exist in the case of Mr. Cheng Parent directory (Parents)
CP Copy files or directories (COPY
-R recursive processing, copy the files under the specified directory with subdirectories (Recursive)
MV move file or directory, file or directory rename (mOvE
Manipulating files or directories common commands
RM Delete file (REmOve
-R deletes all files in the directory at the same time (Recursive)
-F force the deletion of files or directories (FOrce)
RmDir Delete Empty directory (REmOvedirEctoriy)
Cat Displays text file contents (CatEnate)
More, less pagination displays text file contents
Head, tail View the contents of the beginning or end of the text
Haed-n 5 A.log View the first 5 lines of the A.log file
Tail-f B.log Loop Read (follow)
Common commands
The number of lines, words, and characters of the WC statistic text (WOrdCOunt)
-M Statistics text character count
-W Statistics Text word count
-L Statistics Lines of text
Find specified file in file system
find/etc/-name "AAA"
Grep finds the specified string in the specified text file
ln establishes a linked file (LINK
-S establishes a symbolic connection to the source file instead of a hard connection (sYmbolic)
Top Displays the most resource-intensive processes in the current system
PS shows the process status of the moment
-e/-a Show all processes, environment variables
-F Full format
-a displays all processes for all users (including other users)
-U Displays the process in the order of the user name and start time
-X shows the process without control terminal
Kill kills a process
Kill-9 PID
DF shows the use of file system disk space
Du displays the total amount of disk space that is used by the specified file (directory)
-H file size is displayed in K,m,g (human-readable)
-S only shows the sum of each file size (summarize)
Free displays current memory and swap space usage
Netstat Displaying network status information
-A show all connections and listening ports
-T (TCP) displays only TCP-related options
-U (UDP) displays only UDP-related options
-N refuses to display aliases, showing all numbers converted to numbers.
-P Displays the program name that establishes the associated link
Ifconfig NIC Network configuration detailed
Ping testing the connectivity of the network
Backup Compression command
Gzip Compress (unzip) file or directory, zip file suffix to gz
Bzip2 Compress (unzip) the file or directory, the compressed file suffix is bz2
Tar file, directory hit (solution) package
gzip command
Command format: gzip [option] File name for compression (decompression)
-D Unzip the compressed file (Decompress)
-L Displays the size of the compressed file, the size of the uncompressed file, the compression ratio (List)
-V Display file name and compression ratio (verbose)
-num adjusts the speed of compression with the specified number num,-1 or--fast represents the fastest compression method (low compression ratio), 9 or--best represents the slowest compression method (high compression ratio). System default value is 6
bzip2 command
Command format: bzip2 [-cdz] Document name
-C output data generated by the compressed process to the screen
-D Decompression parameters (ecompress)
-Z Compression parameters (compress)
-num adjusts the speed of compression with the specified number num,-1 or--fast represents the fastest compression method (low compression ratio), 9 or--best represents the slowest compression method (high compression ratio). System default value is 6
Tar command
-C Create a parameter directive for a compressedfile (reate)
-X unlocks a parameter directive for a compressed file (extract)
-Z is required to compress with gzip
-j If you need to compress with bzip2
-V compression in the process of displaying files (verbose)
-F Use file name, immediately after F to receive the file name (file)
Shutdown/Restart command
Shutdown system shutdown
-R restart immediately after shutdown
-H does not restart after shutting down the machine
Halt power off after shutdown shutdown-h
Reboot Restart Shutdown-r
A good habit of learning Linux
Good at viewing help documents such as Man page (manual)
Good use of TAB key
Have some shortcut keys in your hands.
CTRL + C (stop current process)
CTRL + R (view command history)
CTRL + L (clear screen, same function as clear command)
Fourth Chapter: Vim text Editor
Vi/vim is the most commonly used text editor on Unix/linux and is very powerful.
Only commands, no menus.
"Big bowl" editor edition
Around the colleague is not using VI is Emacs, if you use Eltraedit are embarrassed to greet others ... What plug-in Ah, syntax highlighting Ah, spell check ah, can give it open all to it open, is a word: cool! You say such an ox x thing, how to learn also have to small half a year. Half!? Getting started is far away! Can learn to move the cursor is good, you don't say you can't afford it, this is still moving around!!!
Vim working mode
Insert command
Position command
Replace and Cancel commands
Delete command
Common shortcut keys
Fifth chapter: User and group account management
The Linux operating system is a multi-user operating system that allows multiple users to log on to the system and use resources at the same time. The system distinguishes each user's files, processes, tasks, and work environments according to the account, so that each user's work is uninterrupted.
Configuration file
Files to save user information:/etc/passwd
File to save password:/etc/shadow
Save file for user group:/etc/group
File to save user group password:/etc/gshadow
User profiles:/etc/default/useradd
/ETC/PASSWD format
Linux User classification
Super User: (Root,uid=0)
Normal User: (UID 500 to 60000)
Pseudo-User: (UID 1 to 499)
Systems and services related to: Bin, daemon, shutdown, etc.
Process-Related: Mail, news, games, etc.
The user cannot log on to the system, and there is no host directory
/etc/shadow format
User groups
Each user belongs to at least one user group
Each user group can contain multiple users
Users of the same user group have permissions shared by this group
/etc/group format
Manipulating User Commands
Add user command: Useradd
-U Specify group ID (uID)
-g Specifies the group name (GID) that belongs to
-G Specify multiple groups, separated by commas "," (Groups)
-C User Description(omment)
-E Expiration Time (expire date)
Example:
Useradd-u 888-g users-g sys,root-c "hr Zhang" Zhangsan
passwd Zhangsan
Modify user command: usermod (usermodify)
-L Modify User name (login) usermod-l a B (b change to a)
-G add group usermod-g sys Tom
-G Add multiple groups usermod-g sys,root Tom
–L Lock user account password (Lock)
–U Unlock user account (Unlock)
Delete user command: Userdel (userdelete)
-R Delete the directory while deleting the account (Remove)
Action User Group command
Add Group: Groupadd
-G Specify GID
Modify Group: Groupmod
-N Change group name (new Group)
Delete Group: Groupdel
Groups displays the group to which the user belongs
The sixth chapter: Rights Management
Three basic permissions
R Read permission (Read)
W Write permission (write)
X Execute permissions (execute)
1th bit: File type (d directory,-normal file, L link file)
第2-4位: The owning user right, denoted by U (user)
第5-7位: The owning group permission, expressed in G (Group)
第8-10位: Other user rights, denoted by O (other)
第2-10位: Represents all permissions, denoted by a (all)
Full information: A file that the owning user has read and write execution permissions;
have read and Write permission, no execute permission, other user only Read permission
Change operation permissions
chmod modify File Permissions command (CHAngeMoDE
Parameters:-R The following files and subdirectories do the same permissions operation (REcursive recursive)
Example: chmod u+x a.txt
Use numbers to represent permissions (r=4,w=2,x=1,-=0)
Example: chmod b.txt
RWX with binary notation is 111, decimal 4+2+1=7
R-x with binary notation is 101, decimal 4+0+1=5
Seventh chapter: RPM Package Management
RPM is an abbreviation for the Redhat Package Manager (Redhat Packages management tool), a file format name that, although Redhat, is open-ended and now includes Redhat, CentOS, Distributed versions of Linux, such as SuSE, are used, and are recognized as industry standards. RPM files are easiest to install on Linux systems
The RPM command uses
Common parameters for rpm
I: Install the application (INstall)
E: Uninstall the application (eRase)
VH: Displays the installation progress;vErbosehAsh
U: Upgrade package;uPdate
QA: Displays all installed packages (QUeryall
Combine the grep command with
Example: Rmp-ivh gcc-c++-4.4.7-3.el6.x86_64.rpm
Yum command
Yum (full name Yellow dog Updater, Modified) is a shell front-end package manager in Fedora and Redhat as well as SuSE and CentOS. Based on RPM package management, the ability to automatically download RPM packages from specified servers and install them, automatically handle dependency relationships, and install all dependent packages at once, without the hassle of downloading and installing them over and over again.
Example (requires Internet, no network can build local source):
Yum Install gcc-c++
Yum Remove gcc-c++
Yum Update gcc-c++
Linux Operating System Basics