linux和windows双系统时间不同步问题
安装linux双系统后,只要进入linux系统,windows的系统时间就会错误。
解决方案:
//更新时间
sudo apt-get install ntpdate
sudo ntpdate ntp.sjtu.edu.cn
//将时间更新到硬件上面
sudo hwclock --localtime --systohc
安装linux双系统后,只要进入linux系统,windows的系统时间就会错误。
解决方案:
//更新时间
sudo apt-get install ntpdate
sudo ntpdate ntp.sjtu.edu.cn
//将时间更新到硬件上面
sudo hwclock --localtime --systohc
速成案例:tcpdump速成指南
最简单的用法就是直接输入tcpdump
,监控所有的数据包:
[ma@ma ~]$ tcpdump
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on usbmon1, link-type USB_LINUX_MMAPPED (USB with padded Linux header), capture size 65535 bytes
10:53:08.002434 CONTROL SUBMIT to 1:2:0
10:53:08.004461 CONTROL COMPLETE from 1:2:0
10:53:08.004502 CONTROL SUBMIT to 1:1:0
10:53:08.004502 CONTROL COMPLETE from 1:1:0
10:53:10.850080 CONTROL SUBMIT to 1:1:0
10:53:10.850102 CONTROL COMPLETE from 1:1:0
在.vimrc
文件中添加:
au BufReadPost * if line("'\"") > 0 | if line("'\"") <= line("$") | exe("norm '\"") | else |exe "norm $"| endif | endif
如果添加后无效,可能是~/.viminfo
和~/.vimrc
这两个文件的所有者非当前用户导致的。
因为vim运行过程中的操作记录(如历史操作和记录上次退出的行数等)都是写入到~/.viminfo中去的,如果当前用户没有权限的话会导致写入失败,功能不生效。
以我这台电脑为例,.viminfo
的所有者是root
,这样就不行:
修改所有者的命令:
sudo chown $USER ~/.viminfo
ubuntu版本16.04
:
root@vm:/data/software# cat /etc/issue
Ubuntu 16.04.4 LTS \n \l
搜狗输入法基于fcitx
,ubuntu默认是IBus
,如要使用先得添加fcitx
相关组件的支持。
下载安装fcitx
极其相关组件:
# 添加软件库
sudo add-apt-repository ppa:fcitx-team/nightly
sudo apt-get install fcitx
sudo apt-get install fcitx-config-gtk
sudo apt-get install fcitx-table-all
sudo apt-get install im-switch
apt-get install zlib1g-dev
apt-get install curl libcurl3 libcurl4-openssl-dev
apt-get install libncurses5-dev
apt-get install python-dev python3-dev
基本用法:find 路径 选项
-name filename
:直接查找该文件名的文件。-type filetype
:通过文件类型查找文件。
文件类型包括:
f:普通文件 b:块设备文件 c:字符设备文件 d:目录 l:链接文档 s:套接字文件
-atime +n/-n
:访问或执行的时间大于或小于n天的文件。-ctime +n/-n
:写入,更改inode属性(如更改所有者、权限或者链接)的时间大于或小于n天的文件。-mtime +n/-n
:表示写入时间大于或小于n天的文件,该参数用的最多。-mmin +n/-n
:表示mtime在n分钟内的文件。使用apt update
的时候遇到错误:
Failed to stop snapd.autoimport.service: Unit snapd.autoimport.service not loaded.
Failed to stop snapd.socket: Unit snapd.socket not loaded.
Failed to stop snapd.service: Unit snapd.service not loaded.
dpkg: error processing package snapd (--purge):
subprocess installed pre-removal script returned error exit status 5
Errors were encountered while processing:
snapd
. 1 ma root 1675 Mar 16 19:02 id_rsa
-rw-r--r--. 1 ma root 406 Mar 16 19:02 id_rsa.pub
把公钥内容添加到登陆密钥文件中:
cat id_rsa.pub >> authorized_keys
## 二、修改配置文件
修改ssh的配置文件:
vi /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
然后使用`service sshd reload`重新载入配置,不要使用`service sshd restart`也不要退出终端,避免配置出错导致无法登陆。
## 三、连接
开启新终端,在用户身份验证方式中选择`public key`:

然后导入私钥即可,确认能登录后再关闭上一个终端。
## 四、关闭密码登录
有了密钥登陆后可以考虑禁止密码登录:
vi /etc/ssh/sshd_config
PasswordAuthentication no
service sshd reload
sort
命令用于对文件和标准输入进行排序,默认以行为单位,根据字典序排序。
$ cat test # 测试文件
tencent 100 1000
baidu 200 500
alibaba 150 800
huawei 130 700
baidu 200 500
$ sort test # 排序
alibaba 150 800
baidu 200 500
baidu 200 500
huawei 130 700
tencent 100 1000