ubuntu tips
1.
File recoding recent activities: ~/.local/share/recently-used.xbel
直接删了就可以清除Dash Home里的最近记录
2.
设置图形界面的开机启动项: 在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=
3.
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
4.
awk 'BEGIN { statements} pattern { command } END { statements} '
中间的pattern 相当于条件判断,command为命令。
例: 截取文件里第一行以为的第2、3栏的内容,并输出他们的和
cat FileName | awk 'RN>1 { sum=$2+$3; print $2, $3, sum } '
5.
- 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.
6.
;way to rename files that containing specila characters
find . -type f -inum `ls -i|grep $FILE_NAME|awk {print $1}` -exec mv {} $NEW_NAME
7.
in vim,type :%!xxd to enter hex mode and use %!xxd -r to exit from hex mode
8.
when the cd drive cant ejcet, run:
sudo ejcet -i off
9.
//print all fields with seperator
cat template.cpp |awk 'BEGIN{FS="}"; OFS="\n"} {$1=$1;print "number "NR, $0}' > aaa