How to use the shell command to get the version of Linux Distributions All In One
How to use the shell command to get the version of Linux Distributions All In One
如何使用 shell 命令获取 Linux 发行版的版本
- hostnamectl
- cat /etc/os-release
- lsb_release -a
Linux Distributions
- Debian
- Ubuntu
- Raspberry Pi OS
https://en.wikipedia.org/wiki/Linux_distribution
solutions
hostnamectl
$ hostnamectl
Static hostname: raspberrypi
Icon name: computer
Machine ID: a983fcbfe97e4a6d89ab5ec87d937b83
Boot ID: b1dbb5a0f2014ce087624c262c67aec3
Operating System: Debian GNU/Linux 11 (bullseye)
Kernel: Linux 6.1.21-v8+
Architecture: arm64
cat /etc/os-release
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
lsb_release -a
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye

$ cat /proc/version
Linux version 6.1.21-v8+ (dom@buildbot) (aarch64-linux-gnu-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023
$ cat /etc/issue
$ more /etc/issue
$ less /etc/issue

demos
grep &
regular expression/ 正则表达式
$ grep '^VERSION' /etc/os-release
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
$ grep -E '^(VERSION|NAME)=' /etc/os-release
NAME="Debian GNU/Linux"
VERSION="11 (bullseye)"

get Linux kernel version
# Linux kernel version
$ uname -r
6.1.21-v8+

( 反爬虫测试!打击盗版️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!
apt-get 命令详解
在安装任何软件之前,我们最好是要更新本地软件包索引(package index)。
本地软件包索引列出了软件仓库中所有可安装的软件包以及版本信息。
$ apt-get update
$ sudo apt-get update
sudo 的在英语里的意思是 switch user and do something.
在Linux系统上,你需要root权限来安装和卸载软件包。sudo可以临时将你的用户ID切换为root。
软件包索引(package index)。本地软件包索引列出了软件仓库中所有
可安装的软件包以及版本信息。$ apt-get update
$ sudo apt-get update
sudo 的在英语里的意思是 switch user and do something.在Linux系统上,你需要root权限来安装和卸载软件包。sudo可以临时将你的用户ID切换为root。
$ apt-get install
apt-get install 是用来安装软件包的。你需要将软件包的名字添加到 apt-get install 之后.
# 在 Ubuntu 系统上安装 Chromium 浏览器
$ sudo apt-get install chromium-browser
有时候apt-get会询问你是否真的要安装软件包。
# 如果你想自动回答**yes**,可以在安装命令中添加 **-y** 选项.
$ sudo apt-get install -y chromium-browser
的Ubuntu系统上已经安装好了Chromium浏览器.
在你用apt-get install命令安装软件包之前,你需要知道这个软件包在软件仓库中的名称.
这看起来有点麻烦.当你熟悉之后,你会感到非常方便.尤其是当你SSH远程管理Linux服务器的时候.
apt-get首先会从软件仓库中下载deb安装包,这些deb安装在 /var/cache/apt/archives目录下;
下载后,apt-get会自动安装软件包
一条命令安装多个软件包
apt-get install 可以一次性安装多个软件包,比如
$ sudo apt-get install wireshark nmap aircrack-ng
$ apt-get upgrade
apt-get upgrade命令用来升级系统上可以升级的软件包.
$ sudo apt-get upgrade
apt-get 会告诉你哪些软件包会升级.并且询问你是否真的需要升级这些软件包.你可以在命令中添加 -y 选项来自动回答yes.
$ sudo apt-get -y upgrade
$ apt-get remove
这条命令用来删除系统上的软件包,比如,删除Firefox
sudo apt-get remove firefox
它不会删除软件包的配置文件.
$ apt-get purge
这条命令可以用来删除软件包及其配置文件.
sudo apt-get purge firefox
$ apt-get clean
当apt-get安装或升级软件包时,它会将deb安装包下载到文件系统的/var/cache/apt/archives目录下.
软件包安装完成后,这些deb安装包基本上就没有什么用处了.apt-get clean命令可以帮你删除这些deb安装包.
你可以使用下面的命令查看/var/cache/apt/archives目录下deb安装包的大小.
$ du -sh /var/cache/apt/archives
$ apt-get autoclean
apt-get autoclean 也可以用来删除 /var/cache/apt/archives目录下的deb安装包.
但它只删除那些已经不能从软件仓库中下载的deb安装包.
这就是说,Debian或Ubuntu已经不维护那些软件包了,或者那些软件包有了一个新的名字.
apt-get autoremove
这条命令用来删除不需要的依赖软件包.
$ apt-get dist-upgrade
这条命令可能会让很多人感到困惑.
在Debian系统上,你用这条命令升级系统版本,比如从Debian 7升级到Debian 8.
但是在Ubuntu系统上,这条命令只会升级Linux内核以及之前没有被升级的软件包.
升级Ubuntu的版本你需要用到do-release-upgrade命令.
附:手动安装Deb软件包
$ dpkg -i
如果你从网站上下载了一个deb软件包,那么你需要dpkg工具来安装这个deb包.
例如,你可以下载 WPS linux 版.然后,在终端里将当前工作目录切换到下载目录,再输入下面的命令安装 WPS Linux版.
$ sudo dpkg -i wps-office*.deb
dpkg 的一个缺点是它不能解决依赖关系.你必须手动安装依赖包.
而 gdebi可以帮助我们自动安装依赖包.输入下面的命令安装 gdebi
$ sudo apt-get install gdebi
# 它的命令语法如下:
$ sudo gdebi <package.deb>
https://github.com/xgqfrms-GitHub/MongoDB/blob/master/MEAN/apt-get命令详解.md
refs
https://www.cyberciti.biz/faq/how-to-check-os-version-in-linux-command-line/
https://support.ucsd.edu/its?id=kb_article_view&sysparm_article=KB0032481
https://github.com/xgqfrms/daily-english-learning/issues/115#issuecomment-1568241155
https://askubuntu.com/questions/497540/where-is-my-wpa-supplicant-conf/1469767?noredirect=1#comment2576150_1469767
xgqfrms 2012-2021
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有️xgqfrms, 禁止转载 ️,侵权必究️!
How to use the shell command to get the version of Linux Distributions All In One的更多相关文章
- ionic打包apkFailed to execute shell command "input,keyevent,82"" on device: Error: adb: Command failed with exit code 137
错误代码如下 BUILD SUCCESSFUL in 12s 46 actionable tasks: 1 executed, 45 up-to-date Built the following ap ...
- Jenkins--Run shell command in jenkins as root user?
You need to modify the permission for jenkins user so that you can run the shell commands. You can i ...
- 时间写入文件名 nohup 原理 Command In Background your shell may have its own version of nohup
echo 123 > `date +%Y-%m-%d-%H.tmp` echo 123 > /home/`date +%Y-%m-%d-%H.tmp` nohup --help [root ...
- I.MX6 Android shutdown shell command
/******************************************************************************* * I.MX6 Android shu ...
- Makefile,Shell command,Shell Language 之间的联系
1. Makefile 首先要知道Makefile 是什么东西,Makefile 是一个指令文件,里面存储着自定义的命令(可以借助已有的命令创造而来)在不同的系统下对Makefile 的区别不一样,L ...
- centos安装安全狗提示Need system command 'locate' to install safedog for linux的解决方法
今天为客户的centos服务器安装安全狗时提示Need system command 'locate' to install safedog for linux.Installation aborte ...
- Jenkins可用环境变量列表以及环境变量的使用(Shell/Command/Maven/Ant)
一.可用环境变量列表(以下来自google翻译): BRANCH_NAME 对于多分支项目,这将被设置为正在构建的分支的名称,例如,如果您希望从而master不是从特征分支部署到生产. CHANGE_ ...
- getopts shell command -options parameters
说明:原文网址http://blog.chinaunix.net/uid-26807463-id-3151601.html 获取UNIX类型的选项: unix有一个优点就是标准UNIX命令在执行时都具 ...
- Android shell command execute Demo
package com.android.utils; import java.io.File; import java.io.IOException; import java.io.InputStre ...
- Linux shell command学习笔记(二)
<cut> 作用:从输入文件或者命令的输出中析取出各种域 用法:cut –c{字符串范围} –d{字段间分割符} –f{字段索引编号} 举例: (1)查看在线用户:who | cut –c ...
随机推荐
- [思维提升|干货All in]6种算法解决LeetCode困难题:滑动窗口最大值
为了更好的阅读体验,欢迎阅读原文: [思维提升|干货All in]6种算法解决LeetCode困难题:滑动窗口最大值 (eriktse.com) 最近在leetcode遇到一道非常经典的题目:239. ...
- 南昌航空大学-软件学院-22206104-段清如-JAVA第一次Blog作业
南昌航空大学-软件学院-22206104-段清如-JAVA第一次Blog作业 前言: 这个学期才开始接触java,到现在一个多月的时间,已经差不多可以写出一些基本的简单的程序了.对比上个学期学习的C语 ...
- DOM选择器之元素节点选择器
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Terraform 系列-Terraform 项目的典型文件布局
系列文章 Terraform 系列文章 典型文件布局 - modules/ - services/ - webserver-cluster/ - examples/ - main.tf - outpu ...
- 开源不到 48 小时获 35k star 的推荐算法「GitHub 热点速览」
本周的热点除了 GPT 各类衍生品之外,还多了一个被马斯克预告过.在愚人节开源出来的推特推荐算法,开源不到 2 天就有了 35k+ 的 star,有意思的是,除了推荐算法本身之外,阅读源码的工程师们甚 ...
- What's the best way to read and understand someone else's code?
Find one thing you know the code does, and trace those actions backward, starting at the end Say, fo ...
- python之opencv库
关于OpenCV简介 OpenCV是一个基于BSD许可(开源)发行的跨平台计算机视觉库,可以运行在Linux.Windows.Android和Mac OS操作系统上.它轻量级而且高效--由一系列 C ...
- Java设计模式 —— 装饰模式
12 装饰模式 12.1 装饰模式概述 Decorator Pattern: 动态地给一个对象增加一些额外的职责.提供一种比使用子类更加灵活的方案来扩展功能. 装饰模式是一种用于替代继承的技术,通过一 ...
- 异常:java.io.FileNotFoundException:e:\demo(拒绝访间。)
禁止向目录中写数据,只能向文件写数据
- oracle删除一张表后,索引,同义词,视图,约束会被删除么
问题描述:看到有一道题,说删除一张表之后,什么会被关联删除 进行测试,看看一张表什么会被关联删除,进行scoot下的EMP进行测试 一.创建测试需求用例 表结构: SQL> desc emp; ...