2019-05-28每周学习笔记

2019-05-28  本文已影响0人  李章文

续上周:

    # do something in current dir
    (cd /some/other/dir && other-command)
    # continue in orignial dir
    diff /etc/hosts <(ssh somehost cat /etc/hosts)
    {
        # Your code here
    }
cat <<EOF
input
on multiple lines
EOF

-Use screen or [tmux](https://tmux.github.io) to multiplex the screen, especially useful on remote ssh sessions and to detach and re-attach to a session. byobu can enhance screen or tmux by providing more information and easier management. A more minimal alternative for session persistence only is [dtach](https://github.com/bogner/dtach).

    TCPKeepAlive=yes
    ServerAliveInterval=15
    ServerAliveCountMax=6
    Compression=yes
    ControlMaster auto
    ControlPath /tmp/%r@%h:%p
    ControlPersist yes
    stat -c '%A %a %n' /etc/timezone
>>> 2+3
5

Processing files and data

    perl -pi.bak -e 's/old-string/new-string/g' my-files-*.txt
    # Full rename of filenames, directories, and contents foo -> bar:
    repren --full --preserve-case --from foo --to bar .
    # Recover backup files whatever.bak -> whatever:
    repren --renames --from '(.*)\.bak' --to '\1' *.bak
    # Same as above, using rename, if available:
    rename 's/\.bak$//' *.bak
mkdir empty && rsync -r --delete empty/ some-dir && rmdir some-dir
    # Displays hex codes or actual names of characters (useful for debugging):
    uconv -f utf-8 -t utf-8 -x '::Any-Hex;' < input.txt
    uconv -f utf-8 -t utf-8 -x '::Any-Name;' < input.txt
    # Lowercase and removes all accents (by expanding and dropping them):
    uconv -f utf-8 -t utf-8 -x '::Any-Lower; :: Any-NFD; [:Nonspacing Mark:]>; ::Any-NFC;' < input.txt > output.txt
    getfacl -R /some/path > permission.txt
    setfacl --restore=permissions.txt

System debugging

上一篇 下一篇

猜你喜欢

热点阅读