ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

CentOS 基本命令

2022-06-15 11:34:25  阅读:175  来源: 互联网

标签:基本 CentOS get coreutils apt 命令 install TEST 环境变量


 

查看服务器位数
getconf LONG_BIT
查看linux版本
uname -a
cat /etc/redhat-release

查看已安装软件(分rpm/deb/yum包安装的)
rpm -qa
dpkg -l
yum list installed
yum list installed | grep anaconda

 

环境变量

#显示环境变量HOME
echo $HOME
#设置新环境变量
export HELLO="Hello!"
echo $HELLO
#使用env命令显示所有的环境变量
env | grep TEST
#使用set命令显示所有本地定义的 Shell 变量
#使用unset命令来清除环境变量
#set可以设置某个环境变量的值。清除环境变量的值用unset命令。如果未指定值,则该变量值将被设为 NULL
unset $TEST
#使用readonly命令设置只读变量
export TEST="Test..."     #增加一个环境变量TEST
readonly TEST             #将环境变量TEST设为只读
unset TEST                 #会发现此变量不能被删除
    -bash: unset: TEST: cannot unset: readonly variable
TEST="New"                 #会发现此也变量不能被修改
    -bash: TEST: readonly variable
#环境变量的设置位于 /etc/profile【对所有用户生效(永久的)】和.bash_profile【对单一用户生效(永久的)】
#如果需要增加新的环境变量可以添加下属行
#vi /etc/profile
export path=$path:/path1:/path2:/pahtN
source /etc/profile

#vim /home/guok/.bash_profile   #guok用户的环境变量
export path=$path:/path1:/path2:/pahtN
source /home/guok/.bash_profile

 

command not found

-bash: uname: command not found

#Debian
apt-get install coreutils

#Ubuntu
apt-get install coreutils

#Alpine
apk add coreutils

#Arch Linux
pacman -S coreutils

#Kali Linux
apt-get install coreutils

#CentOS
yum install coreutils

#Fedora
dnf install coreutils

#OS X
brew install coreutils

#Raspbian
apt-get install coreutils

#Docker
docker run cmd.cat/uname uname
View Code

 -bash: arch: command not found

#Debian
apt-get install coreutils
 
#Ubuntu
apt-get install coreutils
 
#Alpine
apk add coreutils
 
#Arch Linux
pacman -S mailman
 
#Kali Linux
apt-get install coreutils
 
#CentOS
yum install coreutils
 
#Fedora
dnf install coreutils
 
#OS X
brew install coreutils
 
#Raspbian
apt-get install coreutils
 
#Docker
docker run cmd.cat/arch arch
View Code

-bash: uptime command not found

#Debian
apt-get install procps
 
#Ubuntu
apt-get install procps
 
#Alpine
apk add procps
 
#Arch Linux
pacman -S procps-ng
 
#Kali Linux
apt-get install procps
 
#CentOS
yum install procps-ng
 
#Fedora
dnf install procps-ng
 
#Raspbian
apt-get install procps
 
#Docker
docker run cmd.cat/uptime uptime
View Code

 













 

 



 

标签:基本,CentOS,get,coreutils,apt,命令,install,TEST,环境变量
来源: https://www.cnblogs.com/iupoint/p/16377614.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有