zoukankan      html  css  js  c++  java
  • IPython使用UNIX的Shell

    1:alias:别名

    alias nss netstat -lptn

    nss

    结果....

    nss | grep 80

    alias achoo echo "|%1|"

    achoo

    结果:||

    achoo these ar args

    |these are args|

    store achoo可以将别名存放起来,下次继续使用

    2:直接执行

    使用叹号可以直接执行。

    !netstat -lptn

    传递参数的方法:使用$符号

    user="jmjones"

    process="bash"

    !ps aux | grep $user |grep &precess

    3:rehash

    __IP.alias_table

    len(__IP_alias_table)

    rehash

    4:cd pwd等命令可以直接使用

    dihist 访问历史记录

    cd -也可

    5:可变扩展

    for i in range(10):

            !data>${i}.txt

    创建十个txt文件,并将时间记录到这些文件中

    6:字符串处理

    import os

    file_list=!ls

    file_list.grep(os.path.isfile)#过滤掉目录

    输出结果:

    ...

    file_list.grep(os.path.isfile).fields(0,1)#输出第一二列

  • 相关阅读:
    css 基础
    css 基础-1
    html 入门2-表
    CMDB (后台管理) CURD 插件
    序列化
    AES(高级加密)
    API验证
    数据库取时间(分组)
    用户权限 (知识点)
    xss 过滤
  • 原文地址:https://www.cnblogs.com/macula7/p/1960726.html
Copyright © 2011-2022 走看看