编辑
2024-12-17
工作知识
0
请注意,本文编写于 171 天前,最后修改于 171 天前,其中某些信息可能已经过时。

目录

USB设备重置
设置多个声卡同时播放
更新网络时间
user 不在 sudoers 文件中。此事将被报告
修改时区到上海
系统合盖不休眠
自动登录
Qt的对动态库的调试debug
获取页大小
修改eth网卡名字
设置QT版本
linux终端乱码
Windows下命令行关闭进程
VMware 14.x 启动虚拟机系统黑屏
smb在win中配置
关闭x层鼠标显示
gogs报git错误fatal: Out of memory, malloc failed (tried to allocate 317810689 bytes)
linux下创建用户时出现 Creating mailbox file: 文件已存在
win10计算md5值
dd查看进度条
gpg 随机数不够
Linux清除缓存
设置Linux密码限制
边录边播

USB设备重置

C
reset_usb_bus() { for i in `find  /sys/bus/usb/devices/usb*`  do    hubport="${i: -1}-1"    if [ -d ${i}/${hubport} ]    then      # 重置root hub下的端口      echo 0 > ${i}/${hubport}/authorized      echo 1 > ${i}/${hubport}/authorized      # 强制设置power从auto到on      echo on > ${i}/${hubport}/power/control    fi  done }

设置多个声卡同时播放

pacmd load-module module-combine-sink sink_name=multi_sound_card # 加载 combine 模块` pacmd set-default-sink alsa_output.platform-rt5651-sound.stereo-fallback # 设置默认声卡到rt5651上 pacmd set-default-sink multi_sound_card # 设置声卡为同时输出 pacmd set-default-sink alsa_output.platform-hdmi-sound.stereo-fallback #设置默认声卡到HDMI上

更新网络时间

ntpdate -u time.nist.gov ntpdate -u ntp.api.bz hwclock -w 

user 不在 sudoers 文件中。此事将被报告

chmod +w /etc/sudoers vim /etc/sudoers 增加 user root    ALL=(ALL)       ALL user    ALL=(ALL)       ALL chmod -w /etc/sudoers

修改时区到上海

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

系统合盖不休眠

/etc/systemd/logind.conf HandleLidSwitch=ignore HandleLidSwitchDocked=ignore

自动登录

lightdm配置文件 [SeatDefaults] autologin-user=user

Qt的对动态库的调试debug

export QT_DEBUG_PLUGINS=1

获取页大小

getconf PAGE_SIZE

修改eth网卡名字

/etc/udev/rules.d SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{ifindex}=="2", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" udevadm  info  --query=path  --path=/sys/class/net/eth0  --attribute

设置QT版本

qtchooser -install qt5.12.2 /usr/local/Qt-5.12.2/bin/qmake export QT_SELECT=qt5.12.2

linux终端乱码

export LANG=zh_CN.UTF-8  export LANGUAGE=zh_CN.zh

Windows下命令行关闭进程

taskkill /pid WIN_PID -f

VMware 14.x 启动虚拟机系统黑屏

经总结主要原因是14版本之后注册了两个LSP协议(vSockets DGRAM、vSockets STREAM)导致异常!
解决方法:使用LSP修复工具(例如:360安全卫士/金山毒霸里的LSP工具)修复LSP网络协议,或者重置下网络链接

smb在win中配置

1.在《启动和关闭windows功能》中 启用smb/cifs功能
2.在本地安全策略中设置《LAN管理器身份验证级别》设置为,发送LM和NTLM-如果已协商。则使用NTLM v2 会话安全
3.在《网络和共享中心》设置高级共享设置为 启动文件共享,关闭密码保护的共享
4.在smb.conf 中,设置 security=share

关闭x层鼠标显示

cd /etc/lightdm/lightdm.conf xserver-command=X -background none -nocursor   增加-nocursor

gogs报git错误fatal: Out of memory, malloc failed (tried to allocate 317810689 bytes)

[pack]    packsizelimit = 2g    window = 0

linux下创建用户时出现 Creating mailbox file: 文件已存在

linux下添加用户后,会在系统里自动加一个邮箱(系统邮箱),路径是:/var/spool/mail/用户名.

rm -rf /var/spool/mail/用户名

win10计算md5值

Get-FileHash -Algorithm MD5 *.tar.gz

dd查看进度条

dd if=/dev/zero of=test.img status=progress

gpg 随机数不够

rngd -r /dev/urandom

Linux清除缓存

To free pagecache: echo 1 > /proc/sys/vm/drop_cachesTo free dentries and inodes: echo 2 > /proc/sys/vm/drop_cachesTo free pagecache, dentries and inodes: echo 3 > /proc/sys/vm/drop_caches

设置Linux密码限制

/etc/security/pwquality.conf minlen = 6  minclass = 2 usercheck = 0

边录边播

arecord -Dhw:0,0 -r48000 -f S16_LE -c 2 | aplay -Dhw:0,0 -r48000