1

Linux常用命令


查看版本 [root@VM_0_2_centos
~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) 查看内存 [root@VM_0_2_centos ~]# free -m total used free shared buff/cache available Mem: 1839 125 593 0 1120 1539
[root@VM_0_2_centos ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        50G  4.6G   43G  10% /
devtmpfs        911M     0  911M   0% /dev
tmpfs           920M     0  920M   0% /dev/shm
tmpfs           920M  388K  920M   1% /run
tmpfs           920M     0  920M   0% /sys/fs/cgroup
tmpfs           184M     0  184M   0% /run/user/0

查看磁盘空间

  

[root@VM_0_2_centos ~]# cat /proc/cpuinfo  CPU信息
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 79
model name	: Intel(R) Xeon(R) CPU E5-26xx v4
stepping	: 1
microcode	: 0x1
cpu MHz		: 2394.454
cache size	: 4096 KB
physical id	: 0
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch bmi1 avx2 bmi2 rdseed adx xsaveopt
bogomips	: 4788.90
clflush size	: 64
cache_alignment	: 64
address sizes	: 40 bits physical, 48 bits virtual
power management:

  

 

 

[root@VM_0_2_centos ~]# top
top - 09:51:37 up 6 days, 23:37, 1 user, load average: 1.24, 1.23, 1.59
Tasks: 67 total, 1 running, 66 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.0 sy,100.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 1883844 total, 607564 free, 128704 used, 1147576 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 1576312 avail Mem
Unknown command - try 'h' for help
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
10556 root 20 0 150140 1984 1460 R 0.3 0.1 0:00.01 top
1 root 20 0 45392 3684 2496 S 0.0 0.2 0:06.20 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.04 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:04.24 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
6 root 20 0 0 0 0 S 0.0 0.0 0:06.78 kworker/u2:0
7 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
9 root 20 0 0 0 0 S 0.0 0.0 1:35.66 rcu_sched
10 root rt 0 0 0 0 S 0.0 0.0 0:01.91 watchdog/0
12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs
13 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns
14 root 20 0 0 0 0 S 0.0 0.0 0:00.07 khungtaskd
15 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 writeback
16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kintegrityd
17 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset
18 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kblockd

动态信息

  

[root@VM_0_2_centos ~]# ps -ef 或者ps aux
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 Sep08 ?        00:00:06 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
root         2     0  0 Sep08 ?        00:00:00 [kthreadd]

查看当前服务

  

[root@VM_0_2_centos ~]# netstat
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0     52 VM_0_2_centos:ssh       120.244.106.220:9373    ESTABLISHED
tcp        0      0 VM_0_2_centos:50418     72.ip-139-99-102.:14433 ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags       Type       State         I-Node   Path
unix  3      [ ]         DGRAM                    6786     /run/systemd/notify
unix  2      [ ]         DGRAM                    6788     /run/systemd/cgroups-agent
unix  6      [ ]         DGRAM                    6805     /run/systemd/journal/socket

查看端口信息.


  

[root@VM_0_2_centos ~]# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      3422/redis-server * 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      936/sshd            
tcp6       0      0 :::6379                 :::*                    LISTEN      3422/redis-server * 
udp        0      0 0.0.0.0:68              0.0.0.0:*                           865/dhclient        
udp        0      0 172.17.0.1:123          0.0.0.0:*                           513/ntpd            
udp        0      0 172.27.0.2:123          0.0.0.0:*                           513/ntpd            
udp        0      0 127.0.0.1:123           0.0.0.0:*                           513/ntpd            
udp        0      0 0.0.0.0:123             0.0.0.0:*                           513/ntpd            
udp        0      0 0.0.0.0:53411           0.0.0.0:*                           865/dhclient        
udp6       0      0 :::123                  :::*                                513/ntpd            
udp6       0      0 :::57230                :::*                                865/dhclient        
[root@VM_0_2_centos ~]# 

 

^C[root@VM_0_2_centos ~]# crontab -l
查看定时任务.

  

 

安装nginx

 

[root@VM_0_2_centos ~]# yum install nginx -y

  

 

 

 

[root@VM_0_2_centos ~]# systemctl start nginx
[root@VM_0_2_centos ~]# systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2018-09-15 10:50:55 CST; 11s ago
  Process: 12060 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
  Process: 12057 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
  Process: 12056 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
 Main PID: 12062 (nginx)
   CGroup: /system.slice/nginx.service
           ├─12062 nginx: master process /usr/sbin/nginx
           └─12063 nginx: worker process

Sep 15 10:50:55 VM_0_2_centos systemd[1]: Starting The nginx HTTP and reverse proxy server...
Sep 15 10:50:55 VM_0_2_centos nginx[12057]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Sep 15 10:50:55 VM_0_2_centos nginx[12057]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Sep 15 10:50:55 VM_0_2_centos systemd[1]: Failed to read PID from file /run/nginx.pid: Invalid argument
Sep 15 10:50:55 VM_0_2_centos systemd[1]: Started The nginx HTTP and reverse proxy server.
[root@VM_0_2_centos ~]# 

 

https://www.cnblogs.com/pyyu/p/9468680.html?tdsourcetag=s_pcqq_aiomsg

 

 

 

如果要部署网站业务数据,只需要把开发好的程序全放到html目录下即可

[root@oldboy_python /tmp 11:34:52]#ls /opt/nginx1-12/html/
index.html  jssts.jpeg  lhy.mp4  man.jpg  wget-log

因此只需要通过域名/资源,即可访问

 http://www.pyyuc.cn/man.jpg

反向代理。

 

posted @ 2018-09-15 10:29  萌哥-爱学习  阅读(394)  评论(0编辑  收藏  举报