Linux基本操作

基本操作

  1. 查看系统、内核及版本
cat /etc/redhat-release		//查看系统
uname -r					//查看内核
lsb_release -a				//查看版本
  1. 查看CPU
grep "CPU" /proc/cpuinfo
  1. 运行时间
uptime
  1. 查看系统位数
getconf LONG_BIT
  1. 查看硬盘和分区
df -h
  1. 软件安装与卸载
yum update 	//更新系统
yum makecache 软件名	//更新软件源缓存
yum search 软件名		//搜索软件
yum install	软件名		//安装软件
yum remove	软件名		//下载软件
  1. 软件的管理
service 软件名 start	//启动
service 软件名 restart	//重启
service 软件名 stop	//关闭
service 软件名 status	//状态
  1. 文件与文件夹管理
touch 文件名			//创建文件
rmdir abc			 //删除文件夹abc
rm -rf				  //强制删除文件或目录
mkdir -p a/b/c/d	  //递归创建文件夹
cp 源文件 目的地址			  //复制文件
mv a.a c.c			  //重命名或者复制(同一文件夹下为复制)
chmod 0755 d		  //目录权限修改
chown -R 用户名:用户组 e	//目录归属
rm a.bc -rf			  //删除文件或文件夹
ls						//列出当前目录的内容
cd ..					//返回上一级目录
cd ~					//回到家目录/root
cd /root/Desktop		//进入桌面目录
pwd						//显示当前文件路径
  1. 文件的下载
weget http://下载地址
例:
	wget https://mirrors.aliyun.com/centos/7.3.1611/isos/x86_64/CentOS-7-x86_64-DVD-1611.torrent
  1. 压缩和解压
tar zcvf 压缩包名.tar.gz		//压缩
tar zxvf 压缩包名.tar.gz		//解压(由解压文件显示)
tar xzf  压缩包名.tar.gz		//解压(无文件显示)
  1. 显示当前的路径
pwd
  1. 关机与重启
init 0						//在root模式下关机
reboot						//重启
shutdown -h 20				//20分钟后关机
shutdown -h 20 $			//20分钟后关机并在后台运行

你的支持是我创作的莫大动力。。
原文地址:https://www.cnblogs.com/ghbuff/p/12356295.html