• web-linux-shell实现 阿里方案canvas+wss。


    wss://shell.aliyun.com/terminals?cols=92&rows=35

    [root@webshell ~]# python
    Python 3.6.8 (default, Apr 25 2019, 21:02:35)
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import subprocess
    >>> output = subprocess.Popen(['ls','-l'],stdout=subprocess.PIPE,shell=True).communicate()
    >>> output = subprocess.Popen(['free ','-g'],stdout=subprocess.PIPE,shell=True).communicate()
    >>> output
    (b'              total        used        free      shared  buff/cache   available
    Mem:        3880404      988888      118752       25140     2772764     2561112
    Swap:             0           0           0
    ', None)
    >>> output = subprocess.Popen(['tree /'],stdout=subprocess.PIPE,shell=True).communicate()
    ^CTraceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib64/python3.6/subprocess.py", line 850, in communicate
        stdout = self.stdout.read()
    KeyboardInterrupt
    >>>
    KeyboardInterrupt
    >>>
    KeyboardInterrupt
    >>> output = subprocess.Popen(['top'],stdout=subprocess.PIPE,shell=True).communicate()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib64/python3.6/subprocess.py", line 850, in communicate
        stdout = self.stdout.read()
    KeyboardInterrupt
    >>>
    KeyboardInterrupt
    >>> output = subprocess.Popen(['ls'],stdout=subprocess.PIPE,shell=True).communicate()
    >>> output
    (b'config.json
    nohup.out
    npm-debug.log
    pkgTmp
    ', None)
    >>> output = subprocess.Popen(['ll'],stdout=subprocess.PIPE,shell=True).communicate()
    /bin/sh: ll: command not found
    >>> output = subprocess.Popen(['ls','-l'],stdout=subprocess.PIPE,shell=True).communicate()
    >>> output[0]
    b'config.json
    nohup.out
    npm-debug.log
    pkgTmp
    '
    >>> output = subprocess.Popen(['tree','./pkgTmp/'],stdout=subprocess.PIPE,shell=True).communicate()
    >>> output[0]
    b'.
    xe2x94x9cxe2x94x80xe2x94x80 config.json
    xe2x94x9cxe2x94x80xe2x94x80 nohup.out
    xe2x94x9cxe2x94x80xe2x94x80 npm-debug.log
    xe2x94x94xe2x94x80xe2x94x80 pkgTmp
        xe2x94x9cxe2x94x80xe2x94x80 mysql57-community-release-el7-10.noarch.rpm
        xe2x94x94xe2x94x80xe2x94x80 Python-3.7.4.tgz
    
    1 directory, 5 files
    '
    >>> output[0].decode('utf-8')
    '.
    ├── config.json
    ├── nohup.out
    ├── npm-debug.log
    └── pkgTmp
        ├── mysql57-community-release-el7-10.noarch.rpm
        └── Python-3.7.4.tgz
    
    1 directory, 5 files
    '
    >>>
    
    
    
    [root@webshell ~]# tree ./pkgTmp/
    ./pkgTmp/
    ├── mysql57-community-release-el7-10.noarch.rpm
    └── Python-3.7.4.tgz
    
    0 directories, 2 files
    [root@webshell ~]#
    

      

    https://www.cnblogs.com/snow-backup/p/5035792.html

  • 相关阅读:
    目录 —— C语言数据结构与算法分析
    目录 —— STM32裸机
    目录 —— FreeRTOS
    常用存储器介绍
    DMA(Data Memory Access)直接存储器访问
    命令
    文件数据流向
    野指针产生的原因
    内存四区
    SVG 是什么?
  • 原文地址:https://www.cnblogs.com/rsapaper/p/11291250.html
Copyright © 2020-2023  润新知