Linux entry study notes

Linux Study Notes
Linux Study Notes 11. Basics 12. System 73. Website Building (Environmental Construction) 114. Database 131. Basics (
1 ) Linux Common Commands 1.pwd Display Current Path 2.cd Switch Directory 3.ls list files -l details 4.mkdir create folder -p recursively create 5.wc display the number of lines and words in the file file name 6.rm -vf delete recursively 7.cat,tac,more,tail view text Content 8.ps view the process 9.kill -9 pid kill the process 10.Which determine whether the command exists 11.Hostname host name/modify the host name 12.Whoami view the command location 13.Netstat display network status information 14.Alias ​​alias command 7 15.Ln soft link (shortcut) 16.Du show file space usage 17.Df show disk space usage 18. wget download file 19.Shudown shutdown

























20.Halt shutdown and power off
21.Reboot restart
22. Modify the    
hostname hostname hostname
/etc/sysconfig/network Set HOSTNAME
/etc/hosts Set the hostname corresponding to the local id

(2) File permissions and directory configuration
Directory structure
  bin stores binary executable files (ls, cat, mkdir, etc.)
  boot stores various files used for system boot
  dev stores device files
  etc. stores system configuration files
  home stores all user files. The root directory
  lib stores the file system The shared libraries and kernel modules required for the program to run in
  mnt The installation point for the system administrator to install the temporary file system
  opt The location where the additionally installed optional application packages are placed
  proc The virtual file system, which stores the mapping of the current memory
  root superuser directory
  sbin stores binary executable files, only root can access
  tmp sbin is used to store various temporary files
  usr is used to store system applications, the more important directory /usr/local local administrator software installation directory
  var is used to store changes that need to be made during runtime data file



file permissions (rwx)
Read 4 read
Write 2 Write
Execute 1 Execute



-d -xr -xr -x 4 root root 4096 July 9 21:21 boot
type owner group other link number user group size date file name

type : d directory, - normal file, l link File
Set file permissions
         chmod [u owner g group user o other users a all users]
  chmod u+ rwx file: set the specified user
    to 4+2+1=7 if they want the rwx attribute;
if they want the rw- attribute, then 4+2 =6;
if you want the rx attribute, then 4+1=5;
chmod 777 file/folder
Chgrp Change group permissions
(3) File and directory management
ls Display directory content:
ls -la
mkdir Create a directory family A:
mkdir familyA
cd switch Enter the directory of familyA:
cd familyA
ls Display the contents of the current directory:
ls
touch Create a new empty file
touch father.txt There is a father in family A
mkdir Create a directory
mkdir house house
cd switch directory
cd house
mkdir create directory
mkdir kitchen kitchen
cp copy file
cp doll.txt /home/itcast/familyA/house/roomB
mv move file
mv sofa.txt /home/itcast/familyA/house/roomB
rm delete file directory
rm doll.txt
more less display
more book.txt in pagination
wc display the number of lines, words and characters in the document
wc book.txt
find find the specified file
find -name book.txt
grep find the specified string
grep best book.txt
pwd display the current directory
tree Display directory tree
rmdir Delete empty directory
rmdir bathroom
ln -s Establish soft connection
ln -s /home/itcast/familyA/house/roomB /home/roomB
(4) Disk and file system management
Disk mounting and unmounting
Mount setting path mount path
Umount mount path file
              system management ( 5) Compression
and packaging of files and file systems File name Tar Tar -cxzjvf file name/folder name -c compress file -x decompress file -z enable gzip compression -j enable bzip2 compression -v show operation process -f use archive name Zip compression: zip -r file name .zip file / folder Decompression : unzip file name 2. System (1) Users : x encrypted character /etc/shadow user identification number Ordinary user: 1000 start System account: 1-999 b) User management command :



































useradd/adduser Add user
userdel Delete user
usermod Modify user
           options:
useradd –u (UID number)
useradd –p (password)
useradd –g (group)
useradd –s (SHELL)
useradd –d (user directory)
usermod –u (new UID)
usermod –d (user directory)
usermod –g (group name)
usermod –s (SHELL)
usermod –p (new password)
usermod –l (new login name)
usermod –L (lock user account password)
usermod –U ( Unlock user account)

    User group:
c) User group file /etc/gruop
Group name: Password: Group ID: Group member

Password : x encrypted character /etc/gshadow
Group ID
Normal group: 1000 starts
System group: 1- 999
group account maintenance command
groupadd group account name (create new group)
groupadd -g specify group GID
groupmod -g change group GID
groupmod -n change group account name
groupdel group account name (delete specified group account)
password maintenance command
passwd user account name (set user password)
passwd -l user account name (lock user account)
passwd -u user account name (unlock user account ) )
passwd -d user account name (delete account password)
gpasswd -a user account name group account name (add the specified user to the specified group)
gpasswd -d user account name group account name (delete the user from the specified group)
gpasswd - A User account name Group account name (designate the user as the administrator of the group)
Note:
# Administrator $
Ordinary user ( 2

)
Software
installation group group1 update and upgrade yum update update all yum update package1 update the specified package package1 yum check-update check for updatable programs yum upgrade package1 upgrade the specified package package1








yum groupupdate group1 upgrade program group group1

Rmp
install
rpm ivh software package
   uninstall
rpm -qa|grep software keyword
            rpm -e --nodeps software package
(3) Shell programming
(4) service management
1.Service
                 Service status service name 
               Start start
Top Stop
restart Restart
Status Current status
2.Systemctl
              systemctl status iptables
. . . .
   View the process number of the specified service ps -ef | grep httpd
Note: Specify the service to start
          systemctl enable httpd.service
1. systemctl disable httpd.service

(5) X Wdinow
(6) Linux backup
(7) Linux kernel compilation and management
( 8) Firewall settings
1. Firewall
a) open port
firewall-cmd --zone=public --add-port=80/tcp --permanent
b) restart firewall
firewall-cmd --reload
c)firewall start/stop
systemctl start/stop firewalld.service
d) Forbid the firewall to start
systemctl disable firewalld.service #

2. Iptables
a), query firewall status:
service iptables status
b), stop firewall:
service iptables stop
c), start firewall:
service iptables start
d), restart firewall:
service iptables restart
e), permanently close firewall:
chkconfig iptables off
f) 、Enable after permanent shutdown:
chkconfig iptables on
3. Station building (environmental construction)

(1) Lamp
(2) Servlet/JSP server construction
1) Jdk
1. Download jdk
2. Unzip gzip -df Unzip jdk.tar.gz
3. Unzip tar -xvf Unzip jdk.tar
4. Move jdk to /usr/local/java
5. Set environment variables

Make environment variables immediately Effective
source /etc/profile
6. Test java-version

2)Tomcat
1. Download tomcat
2. Unzip tomcat
3. Move tomcat to /usr/local/java
4. Set the environment variable
vi /etc/profile
export CATALINA_BASE=/usr /java/tomcat8
export CATALINA_HOME=/usr/java/tomcat8
save
source /etc/profile
5. Enable tomcat
./startup.sh
./shutdown.sh
/catalina.sh start
/catalina.sh stop
view port
netstat -ant
6, Test localhost:8080

(3) FTP server
(4) SMTP server

4. Database

(1) MySql
startup service:
Systemctl strat mysql
(2) Oracle

5. Application software
VIM
vi filename: open or create a new file, and place the cursor at the beginning of the first line
vi +n filename: open file and place the cursor at the beginning of the nth line
vi + filename: open the file and place the cursor at the beginning of the last line
vi +/pattern filename: open the file and place the cursor at the first string matching pattern
vi -r filename : The system crashed when vi was edited last time, restore filename
vi filename....filename : Open multiple files and edit them in sequence

Move cursor class command
h : Cursor moves left by one character
l : Cursor moves right One character
space: move the cursor one character to the right
Backspace: move the cursor one character to the left
k or Ctrl+p: move the cursor up one line
j or Ctrl+n: move the cursor down one line
Enter: move the cursor down one line
w or W: move the cursor one line to the right Word to prefix
b or B: move the cursor one word to the left to the prefix
e or E: move the cursor to the right one word to the end of the word
): move the cursor to the end of the sentence
( : the cursor moves to the beginning of the sentence
}: the cursor moves to the beginning of the paragraph
{: the cursor moves to the end of the paragraph
nG: the cursor moves to the beginning of the nth line
n+: the cursor moves down n lines
n-: the cursor moves up n lines
n$: the cursor moves To the end of the nth line
H: Move the cursor to the top line of the screen
M: Move the cursor to the middle line of the screen
L: Move the cursor to the last line of the screen
0: (note the number zero) Move the cursor to the beginning of the current line
$: Move the cursor to the current line End

Screen scrolling commands
Ctrl+u: scroll half a screen to the
beginning of the file Ctrl+d: scroll half a screen to the end of the file
Ctrl+f: scroll one screen to the end of the file
Ctrl+b; scroll one screen to the beginning of the file
nz: scroll the nth line To the top of the screen, if n is not specified, the current line will be scrolled to the top of the screen.

Insert text commands
i: before the cursor
I: at the beginning of the current line
a: after the cursor
A: at the end of the current line
o: open a new line below the current line A line
O: open a new line above the current line
r: replace the current character
R: replace the current character and the following characters until the ESC key is pressed
s: starting from the current cursor position, replace the specified number of characters
S with the entered text : delete the specified number of lines and replace them with the entered text
ncw or nCW: modify the specified number of words
nCC: modify the specified number of lines

Delete command
ndw or ndW: delete n-1 words starting at the cursor and after it
do: delete to the beginning of the line
d$: delete to the end of the line
ndd: delete the current line and n-1 lines after it
x or X: delete one Characters, x deletes after the cursor, and X deletes before the cursor
Ctrl+u: delete the text entered in the input mode

Search and replace command
/pattern: search for pattern from the beginning of the cursor to the end of the file
?pattern: from the beginning of the cursor to the end of the file File head search pattern
n: Repeat the last search command in the same direction
N: Repeat the last search command in the opposite direction
: s/p1/p2/g: Replace all p1 in the current line with p2
: n1,n2s/p1/ p2/g: replace all p1 with p2 in lines n1 to n2
: g/p1/s//p2/g: replace all p1 in the file with p2

option setting
all: list all option settings
term: set terminal type
ignoreance: ignore case in searches
list: show tab stops (Ctrl+I) and end-of-line signs ($)
number: show line numbers
report: show number of modifications made by line-oriented commands
terse: show short The warning message
warn: if the current file is not saved when moving to another file, NO write message will be displayed
nomagic: special characters without "\" in front of the search mode are allowed
nowrapscan: prohibit vi from searching from the other end when it reaches both ends of the file
mesg: allow vi to display the information that other users write to their terminal with write

Last line command
: n1,n2 co n3: convert line n1 to line n2 Copy the content between lines to the n3th line
: n1,n2 m n3: move the content between the n1 line to the n2 line to the n3th line
: n1,n2 d: move the content between the n1 line and the n2 line delete
: w : save the current file
: e filename: open the file filename for editing
: x: save the current file and exit
: q: exit vi
: q!: do not save the file and exit vi
: !command: execute shell command command
: n1, n2 w!command: Use the contents of lines n1 to n2 in the file as the input of the command and execute it. If n1 and n2 are not specified, it means that the entire file content is used as the input of the command
: r!command: The output of the command command The result is placed in the current line.

Register operation
"?nyy: save the contents of the current line and its next n lines to the register?, where ? is a letter and n is a number
"?nyw: save the current line and its next n words save to register? , where ? is a letter and n is a number
"?nyl: save the current line and its next n characters to the register?, where ? is a letter and n is a number
"?p: take out the register? and place it at the cursor position. here? Can be a letter or a number
ndd: Delete the text of the current line and its next n lines, and put the deleted content in the delete register No. 1.



Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326974832&siteId=291194637