1.df查看文件系统信息.,今天小编就来说说关于linux常用命令大全?下面更多详细答案一起来看看吧!

linux常用命令大全(常用的几个命令)

linux常用命令大全

一、磁盘管理命令

1.df

查看文件系统信息.

使用模式:

df ‐h df ‐B unit # k m g t P ...

2.du

查看文件的大小.

使用模式:

df ‐s ‐B unit # k m g t P ...

二、网络管理命令

1.ping

测试两台主机之间的网络连通性.

使用模式:

ping IP # IP地址 #ping 192.168.28.1 ping domain # 域名 #ping www.baidu.com # ctrl c 中断命令

2.ifconfig

查看网络设备信息.

使用模式:

ifconfig #所有设备 ifconfig equip_name #特定设备

3.netstat

查看网络程序打开的端口信息.

使用模式:

netstat ‐anp #查看所有端口 netstat ‐anp | grep 'keyword' #根据关键字查找端口

[root@localhost ~]# netstat ‐anp Active Internet connections (servers and established) Proto Recv‐Q Send‐Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN 3732/hpiod tcp 0 0 0.0.0.0:750 0.0.0.0:* LISTEN 3536/rpc.statd tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 3504/portmap tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3759/cupsd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3868/sendmail: acce tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN 3737/python tcp 0 0 :::22 :::* LISTEN 3750/sshd tcp 0 148 ::ffff:192.168.28.130:22 ::ffff:192.168.28.1:57520 ESTABLISHED 5327/1 #关键字 Local Address: 本机IP,网络程序端口 Foreign Address:远程主机IP,网络程序端口 PID:本机网络程序进程标识符 Program name: 本机网络程序名

三、 备份压缩命令

压缩格式:

windows: *.rar *.zip *.7Z

linux: *.zip *.gz *.bz2

1.zip

使用模式:

zip ‐r xxx.zip files

2.unzip

使用模式:

unzip xxx.zip 上传下载: rz #上传文件 sz filename #下载文件

3.tar

打包或压缩文件.

● 打包: 将多个文件合并成一个文件. *.tar

● 压缩: 减少文件容量. gzip *.tar.gz ; bzip2 *.tar.bz2

使用模式:

tar ‐cvf xxx.tar files #打包文件 tar ‐tvf xxx.tar #查看包中有哪些文件 tar ‐xvf xxx.tar #解包 tar ‐xvf xxx.tar ‐C dst_dir #指定解包路径 tar ‐czvf xxx.tar.gz files #用gzip压缩 tar ‐cjvf xxx.tar.bz2 files #用bzip2压缩 tar ‐xzvf xxx.tar.gz #用gzip解压 tar ‐xjvf xxx.tar.bz2 #用bzip2解压 # c create # v view # f file # x 解压,解包 # z gzip # j bzip2

四、 程序安装命令

安装方式:

源码安装(项目2)

rpm安装

windows: *.exe

redhat: *.rpm (redhat package manage)

安装步骤:

▲ s1.查看包是否安装

rpm ‐qa | grep 'keyword'

▲ s2.卸载包

rpm ‐e keyword # earse

▲ s3.安装包

rpm ‐ivh *.rpm # *.rpm包名

,