优秀的编程知识分享平台

网站首页 > 技术文章 正文

linux系统常用命令(linux系统常用命令需要注意什么)

nanyue 2024-08-31 23:59:16 技术文章 4 ℃

Debian系列(麒麟、UOS、ubuntu、kali)常用命令

apt update 更新软件包列表

apt upgrade 升级所有已安装的安装包

apt install apache 安装软件命令(apache为一个软件名)

apt remove apache 卸载软件

apt search apache 搜索软件

apt list --installed 列出所有已安装的软件按包

apt list --upgradable 列出可以升级的软件包

/etc/apt/sources.list 源地址配置文件

Red Hat系列(CentOS)常用命令

yum update 更新系统中所有已安装的软件

yum install apache 安装软件命令(apache为一个软件名)

yum remove apache 卸载软件

yum search apache 搜索软件

yum list 列出所有可安装的软件

yum list installed 列出所有已安装的软件按包

yum list updates 列出可以升级的软件包

yum clean all 清除缓存目录下的旧安装包

/etc/yum.repos.d/CentOS-Base.repo 源地址配置文件

Linux常用文件管理命令

mkdir 123 创建文件夹(123为文件夹名)

mkdir -p /root/123/456 递归创建文件夹

mv 移动文件或重命名

mv /root/123.txt /tmp/123.txt 移动

mv /root/123.txt /root/456.txt 重命名

cp 复制文件

cp /root/*.txt /tmp/ 将root下的txt文件复制到tmp下

touch 1.txt 创建文件,可创建多种格式(.sh .c .py等)

rm 1.txt 删除文件

rm -rf 123 强制删除文件夹

ls -l 查看当前目录下的文件

pwd 查看当前所在目录

cat 1.txt 查看文件内容

vim 1.txt 编辑1.txt文件

tar -czvf 123.tar.gz /123 123.tar.gz为要打包压缩的文件及后缀 /123为要压缩的文件

tar -zxvf 123.tar.gz 解压文件

chmod 文件权限设置命令

find / -name 1.txt 文件搜索命令,搜索根目录下的123.txt

Linux系统常用命令

ping 探测主机联通性

ifconfig 查看ip

ip add 查看ip

systemctl start sshd启动sshd(sshd为举例) systemctl 控制系统服务

systemctl status sshd 查看sshd的状态

systemctl stop sshd 停止sshd

systemctl restart sshd 重启sshd

systemctl enable sshd 设置开机自启

systemctl disable sshd 禁用开机自启

iptables -L 列出系统所有防火墙规则

firewall-cmd --list-all 列出系统所有防火墙规则

top -c -o %CPU -c显示进程的命令 -o按照CPU占用从大到小排序

ps 查看进程

netstat 查看网络状态

kaill -9 PID 结束进程 ps或top可看到软件进程PID

whoami 查看当前用户

id 查看当前用户所属组信息

free -h 查看系统内存

df -h 查看磁盘

rpm -ivh apache.rpm 安装软件

wget http://123.com/123.txt下载文件

curl -O http://123.com/123.txt 下载

uname -a 查看系统信息

cat /proc/version 查看内核版本

lsb_release -a 查看发行版本

喜欢还可以到csdn搜索啊醒

最近发表
标签列表