【Linux】Linux (Ubuntu & Centos7) Summary of Common Skills and Operational Problems

Instructions for clearing garbage in the recycle bin of the cloud server under the Linux system

rm -rf /root/.local/share/Trash/files

rm -rf  /home/hp/.local/share/Trash

Ubuntu uses the sudo command without entering a password, easy to operate

We often use the sudo command to operate in the process of using ubuntu. It is necessary to enter the password repeatedly for verification, which is very cumbersome and unnecessary. The following method can simplify the operation

Open the terminal and enter the following command to modify the configuration file

sudo vim /etc/sudoers

Modify the following configuration files. If you use this method, press ESC to exit when saving , and then you need to use :wq! to force the save, otherwise it will prompt that it is read-only and cannot be saved.

%admin ALL=(ALL)NOPASSWD:ALL

%sudo  ALL=(ALL:ALL)NOPASSWD:ALL

insert image description here
When we use the sudo command again, we will find that there is no need to enter the password, which greatly simplifies the development process and is much more convenient
insert image description here

Software update

sudo apt update
sudo apt upgrade
sudo reboot(重启电脑)

New file command in ubuntu

new folder command

mkdir 【文件夹名】
mkdir caliper-workspace
mkdir networks benchmarks workload (连续创建三个文件夹)

new file command

touch 【文件名】
touch networkConfig.yaml
touch readAsset.js

insert image description here

ls 列出当前目录文件(不包括隐含文件)
ls -a 列出当前目录文件(包括隐含文件)
ls -l 列出当前目录下文件的详细信息

cd .. 回当前目录的上一级目录
cd - 回上一次所在的目录
cd ~ 或 cd 回当前用户的宿主目录
mkdir 目录名 创建一个目录
rmdir 空目录名 删除一个空目录
rm 文件名 文件名 删除一个文件或多个文件
rm -rf 非空目录名 删除一个非空目录下的一切

mv 路经/文件 /经/文件移动相对路经下的文件到绝对路经下
mv 文件名 新名称 在当前目录下改名
find 路经 -name “字符串” 查找路经所在范围内满足字符串匹配的文件和目录

close/kill process

View all process instructions

ps aux
ps -ef

insert image description here

Close the process using the process ID

kill 进程号、kill -9 进程号

Use the process name to close: (the disadvantage is that the graphical interface cannot be closed)

killall 进程名
pkill 进程名

Find before closing

ps -e|grep 进程名
ps -ef|grep 进程名

apt command

apt-cache search package 搜索包
apt-cache show package 获取包的相关信息,如说明、大小、版本等
sudo apt-get install package 安装包
sudo apt-get install package - - reinstall 重新安装包
sudo apt-get -f install 修复安装”-f = –fix-missing”
sudo apt-get remove package 删除包
sudo apt-get remove package - - purge 删除包,包括删除配置文件等
sudo apt-get update 更新源
sudo apt-get upgrade 更新已安装的包
sudo apt-get dist-upgrade 升级系统
sudo apt-get dselect-upgrade 使用 dselect 升级
apt-cache depends package 了解使用依赖
apt-cache rdepends package 是查看该包被哪些包依赖
sudo apt-get build-dep package 安装相关的编译环境
apt-get source package 下载该包的源代码
sudo apt-get clean && sudo apt-get autoclean 清理无用的包
sudo apt-get check 检查是否有损坏的依赖
sudo apt-get clean 清理所有软件缓存(即缓存在/var/cache/apt/archives目录里的deb包)

view current path

ctr键 + L键

insert image description here

After Ubuntu installs vmtools, Window cannot copy files or instructions to it

Solution: Instead of using the official vmtool, use the open source vmtool

sudo apt install open-vm-tools-desktop fuse

Guess you like

Origin blog.csdn.net/weixin_42694422/article/details/129521848