Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux的一些命令 #3

Open
lr6 opened this issue Jan 19, 2024 · 0 comments
Open

Linux的一些命令 #3

lr6 opened this issue Jan 19, 2024 · 0 comments

Comments

@lr6
Copy link
Owner

lr6 commented Jan 19, 2024

服务器配置查看

基本信息

# 查看内核
unname -a

# 查看服务器环境
cat /etc/os-release

查看CPU

lscpu

默认在Linux服务器中,cpu信息都保存在/proc/cpuinfo文件中,通过cat命令结合grep命令我们可以很容易查询出来

# 查看CPU型号信息
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c

# 查看物理CPU个数
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l

# 每个物理CPU中的核数
cat /proc/cpuinfo| grep "cpu cores"| uniq

# 查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l

内存

free -h

环境变量

env

安装 rvm auby rails

# Install GPG keys
gpg --keyserver keyserver.ubuntu.com --recv-key 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

# 安装 rvm ruby rails
curl -sSL https://get.rvm.io | bash -s stable --rails

安装nginx

# 安装 nginx
yum install nginx

# 查看nginx的位置
which nginx

# 进入到安装目录
cd ${nginx dir}

# 执行
./nginx

查看防火墙配置

centos7 内置的防火墙已经从iptables变成了 firewalld

# 查看防火墙配置
firewall-cmd --list-all

# 添加开放的端口
firewall-cmd --add-service=http --permanent
firewall-cmd --add-port=80/tcp --permanent

# 重启防火墙
firewall-cmd --reload

先写这么多,用到其他的命令,再添加上来。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant