ubuntu tips

作者: alex_wood | 来源:发表于2017-03-27 15:05 被阅读0次

    File recoding recent activities: ~/.local/share/recently-used.xbel

    直接删了就可以清除Dash Home里的最近记录

    设置图形界面的开机启动项:  在startup application里直接设置,或者想折腾的,写个 XXX.desktop保存到 ~/.config/autostart/ 这个目录下,具体格式差不多这样:

    [Desktop Entry]
    Type=Application
    Exec=/home/alex/.keynav #执行的脚本位置
    Hidden=false
    NoDisplay=false
    X-GNOME-Autostart-enabled=true
    Name[en_US]=keynav
    Name=keynav
    Comment[en_US]=run keynav deamon
    Comment=
    

    Ubuntu设置开机启动为文本界面:

    /**

    • All procedures I configured the computer to boot up in shell command
      **/

    /etc/default/grub
    Comment the line GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”, by adding # at the beginning, which will disable the Ubuntu purple screen.
    Change GRUB_CMDLINE_LINUX=”" to GRUB_CMDLINE_LINUX=”text”, this makes Ubuntu boot directly into Text Mode.
    Uncomment this line #GRUB_TERMINAL=console, by removing the # at the beginning, this makes Grub Menu into real black & white Text Mode (without background image)
    sudo update-grub

    awk 'BEGIN { statements}  pattern { command } END { statements} '
    

    中间的pattern 相当于条件判断,command为命令。

    例: 截取文件里第一行以为的第2、3栏的内容,并输出他们的和

    cat FileName | awk 'RN>1 { sum=2+3; print 2,3, sum } '

    SIGHUP (1) - Hangup detected on controlling terminal or death of controlling process. Use SIGHUP to reload configuration files and open/close log files.
    SIGKILL (9) - Kill signal. Use SIGKILL as a last resort to kill process. This will not save data or cleaning kill the process.
    SIGTERM (15) - Termination signal. This is the default and safest way to kill process.

    ;way to rename files that containing specila characters
    find . -type f -inum `ls -i|grep $FILE_NAME|awk {print $1}` -exec mv {} $NEW_NAME
    

    in vim,type :%!xxd to enter hex mode and use %!xxd -r to exit from hex mode

    when the cd drive cant ejcet, run:
    sudo ejcet -i off

    //print all fields with seperator
    
    cat template.cpp |awk 'BEGIN{FS="}"; OFS="\n"} {$1=$1;print "number "NR, $0}' > aaa
    
    ${MYVAR#pattern}       # delete shortest match of pattern from the beginning
    ${MYVAR##pattern}      # delete longest match of pattern from the beginning
    ${MYVAR%pattern}       # delete shortest match of pattern from the end
    ${MYVAR%%pattern}      # delete longest match of pattern from the end
    

    https://stackoverflow.com/questions/19482123/extract-part-of-a-string-using-bash-cut-split

    相关文章

      网友评论

        本文标题:ubuntu tips

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