Linux Ubuntu 20.04 系统安装流程
NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
$ sudo add-apt-repository ppa:graphics-drivers/ppa $ ubuntu-drivers devices $ sudo apt install nvidia-driver-460 # edit GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub. 可以不用 GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci=realloc" or GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" $ sudo update-grub $ sudo reboot 移动文件夹下所有文件, 包括子文件夹下的内容
Open a terminal and execute this command:
mv -v ~/Downloads/* ~/Videos/ It will move all the files and folders from Downloads folder to Videos folder.
To move all files, but not folders:
If you are interested in moving all files (but not folders) from Downloads folder to Videos folder, use this command
find ~/Downloads/ -type f -print0 | xargs -0 mv -t ~/Videos To move only files from the Download folders, but not from sub-folders:
If you want to move all files from the Downloads folder, but not any files within folders in the Download folder, use this command:
find ~/Downloads/ -maxdepth 1 -type f -print0 | xargs -0 mv -t ~/Videos here, -maxdepth option specifies how deep find should try, 1 means, only the directory specified in the find command. You can try using 2, 3 also to test.
文件大小查看命令
查看某一个文件夹的大小 du -sh [文件夹] 查看当前文件夹下的文件大小总和 ls | wc -l 文件查找命令
查找遍历文件夹下所有文件后缀为jpg的文件并复制 find [查找文件夹] -name "*.jpg" | xargs -i cp {} [输出文件夹] 批量执行命令 awk
查找文件后批量处理
ls | grep zip | awk -F . '{system("echo " $1)}' "ffmpeg -i " $1 ".wav -ar 36000 ../Wave_2/" $1 ".wav" for %a in ("*.wav") do ffmpeg -i "%a" -ar 36000 "\%~na.wav" script 输入参数: 直接写 $1 就是第一个参数
获得当前文件夹名
echo $(basename $(pwd)) DNS服务器地址修改
找到/etc/resolv.conf
nameserver 就是DNS服务器地址
图形界面添加自动启动项
gnome-session-properties 文本界面设置子启动服务
写服务文件,如nginx.service、redis.service、supervisord.service
[Unit]:服务的说明 Description:描述服务 After:描述服务类别 [Service]服务运行参数的设置 Type=forking 是后台运行的形式 ExecStart 为服务的具体运行命令 ExecReload 为服务的重启命令 ExecStop 为服务的停止命令 PrivateTmp=True 表示给服务分配独立的临时空间 注意:启动、重启、停止命令全部要求使用绝对路径 [Install] 服务安装的相关设置,可设置为多用户 WantedBy=multi-user.target 文件保存在目录下:以754的权限。目录路径:/usr/lib/systemd/system/
设置开机自启动
[root@localhost ~]# systemctl enable nginx.service
[root@localhost ~]# systemctl enable supervisord
停止开机自启动
[root@localhost ~]# systemctl disable nginx.service
[root@localhost ~]# systemctl disable supervisord
验证一下是否为开机启动
[root@localhost ~]# systemctl is-enabled nginx
[root@localhost ~]# systemctl is-enabled supervisord 开机自动启动脚本
写脚本放入/etc/profile.d/
Ubuntu引导损坏 引导修复
双系统Ubuntu 引导修复(Boot Repair)_碧海凌云的博客-CSDN博客_ubuntu引导修复
linux 使用rar
https://www.rarlab.com/download.htm找到对应linux的压缩包
wget https://www.rarlab.com/rar/rarlinux-x64-6.0.2.tar.gz tar -xvf rarlinux-x64-6.0.2.tar.gz cd rar sudo make # 解压 unrar x xxx.rar # 压缩 ubuntu tar 多线程压缩
安装pigz
apt-get install -y pigz 压缩文件夹(默认占用所有cpu核心, 占用率50%-80%)
tar --use-compress-program=pigz -h -cvpf [tar file name] [dir] 解压文件夹
tar --use-compress-program=pigz -xvpf [tar file name] -C [dir] 需要限制cpu占用的话
taskset -c [core number start]-[core number end] [command] 向压缩包里追加文件
tar -rvf [tar file name] [file you need to add] 格式化新的磁盘
Installing A New Hard Drive
InstallingANewHardDrive
Start parted as follows: sudo parted /dev/sdb Create a new GPT disklabel (aka partition table): (parted) mklabel gpt Set the default unit to TB: (parted) unit TB Create one partition occupying all the space on the drive. For a 4TB drive: (parted) mkpart
Partition name? []? primary
File system type? [ext2]? ext4
Start? 0
End? 4 Check that the results are correct: (parted) print There should be one partition occupying the entire drive.
Save and quit “parted”: (parted) quit Command Line Formatting To format the new partition as ext4 file system (best for use under Ubuntu):
sudo mkfs -t ext4 /dev/sdb1 To format the new partition as fat32 file system (best for use under Ubuntu & Windows):
sudo mkfs -t fat32 /dev/sdb1 As always, substitute “/dev/sdb1” with your own partition’s path.
匹配k380键盘
可能成功
Pairing LOGITECH K380 in Ubuntu 20.04
Arch Linux
开发常用组件安装,遇到gcc之类的基础组件缺失时使用
apt-get install build-essential 向日葵 远程登录失败问题
需要轻量化桌面
sudo apt install lightdm 查看某个文件夹下文件或文件夹的数量(递归)
# 查看文件数量 ls -lR | grep "^-" | wc -l # 查看文件夹数量 ls -lR | grep "^d" | wc -l 非root用户cuda安装
安装CUDA和cuDNN到指定目录_kxqt233的博客-CSDN博客_cudnn安装位置
磁盘空间清理
rm -rf ~/.cache/pip conda clean -a htop设置
使用htop命令查看进程的时候可以关闭重复线程方便查看 F2 (Setup) -Display options --Hide userland threads F10 (Done) Ubuntu 隐藏上方状态栏、左边任务栏及菜单按钮移到下方居中及隐藏(详细)
Ubuntu 隐藏上方状态栏、左边任务栏及菜单按钮移到下方居中及隐藏(详细)_锵锵锵锵~蒋的博客-CSDN博客_ubuntu隐藏任务栏
ubuntu 20.04 vps 开机自启动
cd /etc/profile.d/ vim xxx.sh chmod a+x xxx.sh zip相关指令
1.1. 查看压缩包内容和统计 zip -sf images.zip | grep -v *.jpg | wc -l zip -sf: 查看zip压缩包内容 grep -v: 去除不需要的行, 筛选需要的文件名 wc -l: 按行统计 1.2. 解压压缩包内部分文件 zip -sf images.zip | head -n 10 # 查看压缩包前10行内容 unzip images.zip "images/00001/000003.jpg" -d . # 解压单个文件到当前文件夹 1.3. 批量压缩文件夹并删除原文件夹 find . -maxdepth 1 -type d ! -name "." -exec sh -c 'zip -r -6 "{}.zip" "{}" && rm -r "{}"' \; ...