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\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
web-linux-shell实现 阿里方案canvas+wss。的更多相关文章
- 阿里Linux Shell脚本面试25个经典问答
转载: 阿里Linux Shell脚本面试25个经典问答 Q:1 Shell脚本是什么.它是必需的吗? 答:一个Shell脚本是一个文本文件,包含一个或多个命令.作为系统管理员,我们经常需要使用多个命 ...
- Linux云主机 监控方案浅析
1.为何需要监控 监控是运维工程师的眼睛,它可帮助运维工程师第一时间发现系统的问题. 对于服务器的整个生命周期,都要和监控打交道: 当有服务器上架,都需要加入比如CPU负载.内存.网络.磁盘等基础监控 ...
- Linux Shell脚本攻略 读书笔记
Linux Shell脚本攻略 读书笔记 这是一本小书,总共253页,但内容却很丰富,书中的示例小巧而实用,对我这样总是在shell门前徘徊的人来说真是如获至宝:最有价值的当属文本处理,对这块我单独整 ...
- Linux Shell脚本教程
v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VM ...
- 【转】Awk 命令学习总结、AWk命令系列学习(linux shell)
前面的话 学习linux 的同人,都知道linux shell文本处理能力非常强大.有一组强大的文本处理工具:grep,sed,awk . 其中grep 经常用作查找匹配文本.sed用作文本编辑替换. ...
- 读《Linux Shell脚本攻略》(第2版) 总结
前段时间读完了<Linux Shell脚本攻略>(第2版)这本书,给部分想读这本书的人分享下个人感受. 说下这本书的难度吧.纯新手或者只懂少部分编程知识的人,读起来还是有很大难度的.以我为 ...
- laravel项目使用appnode部署linux系统到阿里云服务器流程记录(待补充)
使用 SSH 连接工具,如 PuTTY.XShell.SecureCRT 等,连接 Linux 服务器后(阿里云服务器命令行内直接输入appnode安装命令,版本:mysql选5.7.php选7.2) ...
- 读《Linux Shell脚本攻略》(第2版) 一遍、二遍体会
前段时间读完了<Linux Shell脚本攻略>(第2版)这本书,给部分想读这本书的人分享下个人感受. 第一遍体会解读:就像黑夜中的灯塔,指明前进的道路. 推荐指数:强烈推荐. 书中讲解的 ...
- Awk 命令学习总结、AWk命令系列学习(linux shell)
AWK基本语法 下面没有提到awk命令怎么使用了,你可以通过 运行:awk –h 查询到所有命令及参数!下面把awk作为一门语言分节介绍. linux awk 内置变量使用介绍 awk语言中,怎么 ...
随机推荐
- 调试freeradius 3.0 与microsoft AD通过LDAP认证的笔记
首先来参考文章: a.https://blog.51cto.com/liqingbiao/2146832?utm_source=oschina-app 这个主要参考了基本安装.配置.测试 b.http ...
- prometheus operator 部署
prometheus operator 部署自定义记录 环境: k8s 1.11集群版本,kubeadm部署 docker 17.3.2版本 Centos 7系统 阿里云服务器 operator 源码 ...
- 2019-2020-1 20199312《Linux内核原理与分析》第十二周作业
实验背景 2014年9月24日,Bash中发现了一个严重漏洞shellshock,该漏洞可用于许多系统,并且既可以远程也可以在本地触发.在本实验中,学生需要亲手重现攻击来理解该漏洞,并回答一些问题. ...
- java中split函数参数特殊字符的处理(转义),如:"." 、"\"、"|"
内容介绍 本文主要介绍java中特殊字符做为split函数的参数,如:"." ."\"."|",双引号等,不能正确分隔源字符串的处理方法. ...
- 【mssql】增删改查笔记
一.插入数据 1.插入数据返回当前主键ID 当我们插入一条数据的时候,我们很多时候都想立刻获取当前插入的主键值返回以做它用.我们通常的做法有如下几种: 1. 先 select max(id) +1 , ...
- Poj 1743 Musical Theme(后缀数组+二分答案)
Musical Theme Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 28435 Accepted: 9604 Descri ...
- 力扣50题 Pow(x,n)
本题是力扣网第50题. 实现 pow(x, n) ,即计算 x 的 n 次幂函数. 采用递归和非递归思路python实现. class Solution: #递归思路 def myPow_recurs ...
- 在Xilinx ISE中生成ROM时需要注意的事
在Xilinx ISE中生成ROM时,需要指定.coe文件.需要做到两件事.其一,要使用memory_initialization_radix= ; memory_initializatoin_vec ...
- 第12组 Alpha冲刺(2/6)
Header 队名:To Be Done 组长博客 作业博客 团队项目进行情况 燃尽图(组内共享) 展示Git当日代码/文档签入记录(组内共享) 注: 由于GitHub的免费范围内对多人开发存在较多限 ...
- python2 && python3 的 input函数
Python2.x中的input()函数input()函数让我们明确我们输入的是数字格式还是字符格式,就是我们自己要知道我们想要的是什么,数字格式直接输入,字符格式必须加上单引号或者双引号,以确定我们 ...