Linux notebook machine must be shut down immediately
sudo shutdown -t now
Set fish as the default shell
chsh -s /usr/bin/fish
Installing the SSH Service
sudo apt install sshd
Make your sudo taunt you with the wrong password
sudo visudo然后在配置中加入如下一行:Defaults insults
Installing SS-QT5
sudo add-apt-repository ppa:hzwhuang/ss-qt5sudo apt install shadowsocks-qt5
Vim Simple Configuration
set number "显示行号filetype onset history=1000syntax on "打开语法高亮显示 set autoindent "自动对齐,使用上一行的对齐方式set smartindent "智能对齐方式set tabstop=4set shiftwidth=4set showmatch "设置匹配模式set ruler "在编辑过程中,在右下角显示光标位置的状态行autocmd Insertleave * se nocul //浅色高亮当前行autocmd InsertEnter * se cul //浅色高亮当前行set mouse=aset encoding=utf-8hi Normal ctermbg=Black ctermfg=white //修改背景色
Consolas Font Installation configuration
下载:https://code.google.com/archive/p/uigroupcode/downloads将上面下载的字体包解压,并按如下操作:sudo mkdir -p /usr/share/fonts/consolassudo cp YaHei.Consolas.1.12.ttf /usr/share/fonts/consolas/sudo chmod 644 /usr/share/fonts/consolas/YaHei.Consolas.1.12.ttfcd /usr/share/fonts/consolassudo mkfontscale && sudo mkfontdir && sudo fc-cache -fv
Modify DNS
进入 /etc/network/interfaces 在它的最后增加一句:dns-nameservers 8.8.8.8 (或者别的啥)临时修改就在 /etc/resolv.conf 中加入nameserver 8.8.8.8nameserver 8.8.4.4 (之类的)
Common Operations Refresh DNS
sudo apt install nscd (如果没有装的话)/etc/init.d/nscd restart
Run the new NetEase cloud music
sudo netease-cloud-music
Unzip the tar.gz package
tar -xzvf ***.tar.gz
View all process not related to terminal
ps -a
Process Tree
pstree
System process Dynamic View
top
Find process
pgrep ***
Kill process by Process name
pkill ***
View System Load Details
sudo atop
View current system path
pwd
View Help
man ***
View current TTY window number
tty
Running tasks in the background
nohup *** &
View all available font names
fc-list
String Regular match
grep match_pattern file_name
Solve the problem of xauthority
sudo rm ~/.Xauthority-*sudo touch ~/.Xauthority ; sudo chown $LOGNAME ~/.Xauthority ; chmod 775 ~/.Xauthority
To monitor a command run result:
watch
命令格式: watch[参数][命令]命令参数:-n或--interval 缺省每2秒运行一下程序,可以用-n或-interval来指定间隔的时间。-d或--differences 会高亮显示变化的区域。 而-d=cumulative选项会把变动过的地方(不管最近的那次有没有变动)都高亮显示出来。-t 或-no-title 会关闭watch命令在顶部的时间间隔,命令,当前时间的输出。-h, --help 查看帮助文档。
Funny Sao Action Watch instance-command line clock
watch -t -n1 "date +%T|toilet"
Enhanced Clock
watch -t -n1 "date +%T|toilet -fbigmono12"
To record terminal operations:
script & scriptreplay
录制命令:script -t 2>example.time -a example.txt播放命令:scriptreplay example.time example.txt两个文件可以随便命名 例如timing.log和output.session解释:1. -t是把时间数据输出到标准错误(standard error),这里使用 2>example.time 把数据重定向到example.time这个文件当中.2. -a 选项则指定输出录制的文件.3. 在录制过程中,使用 exit 结束录制过程.
Hacker Empire Terminal
sudo apt install cmatrix选项-a :异步滚动(默认)-b :随机粗体-B :全部粗体-h :获得帮助信息-n :不使用粗体(默认)-s :屏保模式 任意键退出-u :刷新频率,0-9,也就是滚动的快慢-C :显示的颜色,支持green(默认),red,blue,white,yellow,cyan,magenta,black在运行的状态下直接按q 即可退出程序
High-end display of Linux system Information
screenfetch
Small train
sl 或者 LS
Art Word
toilet 一些文本
Decomposition factorization
factor ***
Output infinite characters
yes ***
Show Fire
aafire
Cat following the mouse
oneko
Hardware-related brush BIOS
flashrom
viewing system information (in place of Cpu-z)
cpu-g https://sourceforge.net/projects/cpug/i-nex https://sourceforge.net/projects/i-nex/ 或者: sudo add-apt-repository ppa:gambas-team/gambas3 && sudo add-apt-repository ppa:i-nex-development-team/stable && sudo apt-get update sudo apt-get install debhelper devscripts pkg-config dpkg-dev lsb-release gambas3-dev gambas3-gb-image gambas3-gb-qt5 gambas3-gb-form gambas3-gb-desktop gambas3-gb-form-stock git sudo apt-get install i-nex
Detailed boot information (kernel hardware, etc.)
dmesg
Detailed Memory information
cat /proc/meminfo
Detailed CPU Information
cat /proc/cpuifo
CPU Information only Frequency
cat /proc/cpuinfo |grep MHz|uniq
Proc Hardware Information Integration
sudo lshw (-short)
Operating system related information
uname -a
Hardware information (DMI)
dmidecode 显示全部dmi信息dmidecode -q (–quite) 只显示必要的信息dmidecode -t TYPE 指定信息类型 例如memory bios processor
Hardware information
hardinfo
CPU Real-time information
i7z
The frequency of each logical CPU
sudo cpupower monitor
View various sensor data
sensors-detectsensors
CPU monitoring tool for a console UI
s-tui
sudo apt install gcc python-dev python-pip(可选:sudo apt install stress)sudo pip install s-tuisudo s-tui
TTY optimization related to support Chinese command line
zhcon
sudo zhcon --utf8
Remote Desktop VNC:
tigervnc
https://bintray.com/tigervnc/stable/tigervnc/1.8.0#files启动: vncserver帮助:vncserver -help列出进程: vncserver -list杀进程: vncserver -kill :* (* 为桌面号)端口: 5900+* (* 为对应桌面号)
Intranet Penetration:
frp
https://github.com/fatedier/frp/releases配置文档:https://github.com/fatedier/frp/blob/master/README_zh.md
Task Boot up
sudo vim /etc/systemd/system/ *** .service 新建此文件,并写入以下内容[Unit]Description=*** daemon# 下面两行意味着网络准备好以后才会启动命令# After=syslog.target network.target# Wants=network.target[Service]Type=simpleExecStart= *** # 启动指令Restart= alwaysRestartSec=1min[Install]WantedBy=multi-user.target然后设为开机自启动:sudo systemctl start ***sudo systemctl enable ***
Support for Chinese console:
fbterm
Configuration
sudo apt install fbtermsudo fbterm 或者 sudo fbterm fish 运行然后修改~/.fbtermrcfont-names=YaHei Consolas Hybridfont-size=18font-width=-2font-height=-4color-foreground=0color-background=7text-encodings=zh_CN.UTF-8获得纯白的方法:echo -en "\e]P7ffffff"clear如果要支持中文输入法的话,安装fcitx-frontend-fbterm,然后运行:sudo setcap ‘cap_sys_tty_config+ep‘ /usr/bin/fbterm并且在.fbtermrc里设置input-method=fcitx-fbterm
Automatically run scripts on boot
创建一个脚本文件: *** .sh编写内容,开头一定要是#!/bin/sh 或者 #!/usr/bin/fish 等表示在哪个shell下执行命令然后下面必须有LSB描述信息:### BEGIN INIT INFO# Provides: *** .sh# Required-Start: $syslog $remote_fs $network# Required-Stop: $syslog $remote_fs $network# Default-Start: 2 3 4 5# Default-Stop: 0 1 6# Short-Description: starts the *** .sh daemon# Description: starts *** .sh using start-stop-daemon### END INIT INFO执行如下指令:sudo chmod 755 *** .sh让脚本具备可执行权限将 *** .sh移动到/etc/init.d路径下,可以直接拷贝执行:cd /etc/init.d/sudo update-rc.d *** .sh defaults 90在这里90表明一个优先级,越高表示执行的越晚如果要移除脚本:sudo update-rc.d -f *** .sh remove获取sudo的方式:echo PASSWORD | sudo -S ls
Fish Boot Load Script location
~/.config/fish/config.fish
Fish Shell Determines whether it is a TTY command line or a graphical interface command line to start fbterm
脚本位于~/.config/fish/config.fish内容如下: if tty | grep tty nohup vncserver :1 & echo PASSWORD | sudo -S ls fcitx-fbterm-helper -l # 如果要开机启动输入法 那就用这句 # sudo fbterm fish # 如果不要输入法 就用这句 如果想要开机登陆到root用户,这段可以这样: sudo fcitx sudo fcitx-fbterm-helper sudo fbterm fish 如果想在fbterm里exit以后直接退出登陆,那么再加: echo PASSWORD | sudo -S ls sudo kill %self else sudo echo -en "\e]P7ffffff" clear end这段脚本的运行逻辑:每次登陆到一个tty进入fish的时候先试着启动vnc然后往下运行到sudo fbterm fish,递归下一层进入fbterm发现tty得到的不是tty而是pts于是执行刷新白色的操作等到这个fbterm最后exit的时候就回溯到kill %self,直接把上一层的依赖fish给杀掉,于是退出当前这个tty的登陆依赖关系为: login - fish - sudo - fbterm - fish注意,如果最开始登陆的那个tty退出的话,vnc会跟着退出。因为vnc是依赖于tty运行的,一直运行着的那个vnc:1自然是依赖于最早启动的tty一旦最早登录的那个tty被退出,vnc:1自然就会被杀掉。
"03" Linux Notes