美文网首页
Shell命令窗口下的剪贴板操作

Shell命令窗口下的剪贴板操作

作者: Wavky | 来源:发表于2018-08-05 20:23 被阅读0次

    Mac

    Mac自带工具pbcopypbpaste

    复制
    pbcopy < file.txt
    cat file.txt | pycopy
    
    粘贴
    pbpaste > file.txt
    

    Ubuntu

    Ubuntu需要安装xclip工具:

    sudo apt-get install xclip
    
    
    复制(到 gnome 的剪贴板)
    xclip -selection < file.txt
    cat file.txt | xclip -selection
    
    粘贴
    xclip > file.txt
    

    Linux

    Linux自带xsel工具:

    复制(到 gnome 的剪贴板)
    xsel < file.txt
    cat file.txt | xsel
    
    粘贴
    xsel > file.txt
    

    Windows

    Windows系统自带clip工具:

    复制
    clip < file.txt
    echo file.txt | clip
    
    粘贴
    clip > file.txt
    

    参考:bcopy,xsel用法 terminal 复制粘帖 (mac, ubuntu)

    相关文章

      网友评论

          本文标题:Shell命令窗口下的剪贴板操作

          本文链接:https://www.haomeiwen.com/subject/ascivftx.html