zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    [Lydsy1706月赛]大根堆
    某考试 T1 Function
    [SHOI2016] 随机序列
    某考试 T1 至危警告
    某考试 T2 yja
    bzoj1880 [Sdoi2009]Elaxia的路线
    bzoj1804 [Ioi2007]Flood 洪水
    bzoj4546 codechef XRQRS
    bzoj4547 小奇的集合
    bzoj1443 [JSOI2009]游戏Game
  • 原文地址:https://www.cnblogs.com/rsapaper/p/11291250.html
Copyright © 2011-2022 走看看