web-linux-shell实现 阿里方案canvas+wss。
2024-08-22 11:39:27
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\nMem: 3880404 988888 118752 25140 2772764 2561112\nSwap: 0 0 0\n', 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\nnohup.out\nnpm-debug.log\npkgTmp\n', 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\nnohup.out\nnpm-debug.log\npkgTmp\n'
>>> output = subprocess.Popen(['tree','./pkgTmp/'],stdout=subprocess.PIPE,shell=True).communicate()
>>> output[0]
b'.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 config.json\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 nohup.out\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 npm-debug.log\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 pkgTmp\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 mysql57-community-release-el7-10.noarch.rpm\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Python-3.7.4.tgz\n\n1 directory, 5 files\n'
>>> output[0].decode('utf-8')
'.\n├── config.json\n├── nohup.out\n├── npm-debug.log\n└── pkgTmp\n ├── mysql57-community-release-el7-10.noarch.rpm\n └── Python-3.7.4.tgz\n\n1 directory, 5 files\n'
>>> [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
最新文章
- R语言作为BI中ETL的工具
- XCode6 生成prefix.pch文件
- LLVM example for main
- Microsoft .NET Native Developer Preview 内部初探(1)
- 《oracle每日一练》oralce数据库的导入导出
- hdu 3887 Counting Offspring dfs序+树状数组
- Wireshark和TcpDump抓包分析心得
- CF Amr and Pins (数学)
- web移动开发最佳实践之html篇
- c++内存管理错误记录
- Mac端SVN工具CornerStone详解
- 企业面试必会shell
- 网站添加icon
- zblog如何更改数据库配置以及生效
- thinkphp5 图片下载保存
- Itreatot接口实现类中modCount的作用
- http 概念
- 20155228 实验一《Java开发环境的熟悉》实验报告
- 29-jsp中用js进行时间格式转化
- bulk_write&;Replace_one
热门文章
- mybatis中如何将多个表的查询结果,放入结果集中返回
- 基于335X平台Linux交换芯片驱动开发
- centos7误删除python2.7导致的python和yum不可用处理
- gdb调试(一)
- machine learning (3)---Linear Algebra Review
- JS基础篇之作用域、执行上下文、this、闭包
- asp.net使用WebUploader做大文件的分块和断点续传
- luogu 2312 解方程 乱搞+取模
- 浅析python-socket编程
- 小程序中怎么引入wepy.js第三方toast组件