Linux novices into the pit 1 common commands for installing software

The author used to be a nail user of win7. It was deepin linux that made me stay in linux. After using deepin for a year, I feel that the stability is a little lacking. Now I am using linux mint. Write some posts to help newbies who come from windows to use deepin or ubuntu and other Debian series

Common commands for software packages

sudo apt update         更新软件包,并提醒是否安装
sudo apt upgrade        升级本地软件

The above two are frequently used and the most used are mainly used for upgrading. If you install the software and prompt that there is insufficient dependency, you can execute the above two instructions and restart the computer.
Note that when using the sudo command system, you will be asked to enter the administrator password. Most of the passwords are not prompted under linux, unlike windows that will use **** to remind you to enter several passwords. So after you enter it, just press Enter

install software

sudo apt install <包名>

For example, I install Firefox

sudo apt install firefox

About the Tab button

To learn to use the Tab key to automatically complete, it is to the left of the letter Q. For example, when I typed sudo apt ins and pressed Tab, the terminal will automatically complete the word install.

For another example, I want to install the telegram-desktop package, but I forgot the full name of the specific package, what should I do? I only remember that he started with tele. Can i type

sudo apt install tele

At this time, I clicked Tab again and did not reflect (it means that there is more than one software in the software warehouse starting with tele). At this time, if you quickly press Tab twice, the system will list all the software in the software warehouse starting with tele, about twenty or so . So you can enter slowly according to the prompt, I will enter a few more letters

sudo apt install telegr

Press Tab again and you will find that he can complete telegram-. Then press tab twice and find that there are only two or three packages beginning with telegram-. In this way, you can recall the package name based on the four letters of telegram instead of memorizing it. Come down.

After installing the software, the software installation package is not deleted, you can use the following command to delete the downloaded installation package

sudo apt autoclean                       清理未安装软件的安装包
sudo apt clean      	                    清理所有安装包

Uninstall software

sudo apt purge <包名>

How do I know which packages I have installed?

What if I know that I have installed Baidu Netdisk, but I don't know his full name, and I only know that the package name contains baidu? You can use the second instruction below

dpkg -l 		   		列出所有安装的包
dpkg -l | grep -i baidu  在所有的包里查找名字里含有baidu的包并显示出来
				        -i的意思是匹配baidu时忽略大小写。

After finding the package name, you can sudo apt purge <package name>

Delete software configuration files

You may notice that when using dpkg -l, most of the leftmost software listed are ii signs, and some are rc signs. ii means that the package is installed, rc means that the package is uninstalled but the configuration remains.
use

dpkg -l |grep ^rc              #注释rc前面加^表示找出以rc开头的内容

Sentence to check if there are such remnants. If there is no output from your terminal, it means that there is no such software. If you execute the following sentence to clean it up completely, as for how the following sentence is implemented, I won’t explain it here. Novice.

dpkg -l | grep '^rc' | awk '{print $2}' | sudo xargs dpkg --purge

A software installation package of the linux system depends on some small packages to run normally. Suppose I installed Google Chrome and Firefox browser at the same time, and they also depend on a small package named a. When I uninstall these two browsers, this small package a will no longer be used by other software packages, then it becomes Lonely bag, like an orphan. There may be many package systems like this, most of which are generated after the software is uninstalled. You can use the following command to uninstall these lonely packages. Still the same. If there is no output from the terminal, it means that there is no orphan package.

sudo apt autoremove

The following is a supplement to grep, you can ignore it

grep用于匹配文件里面的内容,和find有所区别。grep是用正则号,而find是用用通配符

. 表示任意一个字符。
在grep “c*” file表达式中,*前面添加单个的任何字符都没有意义(显示所有内容)。
grep "cc*"显示所有含c的行,(所有的c都高亮)
grep "ccc*"匹配所有含cc的行

grep [abc] file :只要一行含有abc中的任意一个字符,那么显示这一行(所有abc高亮)
[a-zA-Z] :表示匹配一个字符,这个字符必须是a-z或A-Z这52个字母中的一个。
[^123] :匹配一个字符,这个字符是除了1、2、3以外的所有字符。

对于一些常用的字符集,系统做了定义:
[A-Za-z] 等价于 [[:alpha:]]
[0-9] 等价于 [[:digit:]]
[A-Za-z0-9] 等价于 [[:alnum:]]
tab,space 等空白字符 [[:space:]]
[A-Z] 等价于 [[:upper:]]
[a-z] 等价于 [[:lower:]]
标点符号 [[:punct:]]

Guess you like

Origin blog.csdn.net/qq_35543026/article/details/112980655