CentOS常用shell命令
2016-10-23 00:00
274 查看
摘要: CentOS常用shell命令
shell命令执行环境:CentOS 6.5,Linux下基本通用,写的都是服务器运维用得上的,注意触类旁通。
yum的方式安装软件
[root@localhost /]# yum -y install lsb
yum的方式卸载软件
[root@localhost /]# yum -y remove lsb
操作系统更新
[root@localhost /]# yum update -y
查看系统内核及版本
[root@localhost /]# lsb_release -a
查看机器IP及网络状态
[root@localhost /]# ifconfig
查看系统当前时间
[root@localhost /]# date -R
同步系统时间
[root@localhost /]# ntpdate cn.ntp.org.cn
查询命令的用法
[root@localhost /]# man date
查看磁盘分区信息
[root@localhost /]# fdisk -l
查看磁盘使用情况
[root@localhost /]# df -hl
查看当前目录下文件所占的磁盘空间
[root@localhost /]# du -sh *
查看系统负载
[root@localhost /]# top
查看系统内存使用情况
[root@localhost /]# free -m
清除当前屏幕
[root@localhost /]# clear
定位到指定目录
[root@localhost /]# cd /home
显示目录下的文件信息
[root@localhost /]# ll
从根目录查找文件
[root@localhost /]# find / -name info.log
从文件尾部滚动读取文件并过滤关键字
[root@localhost /]# tail -f nohup.out | grep token
查看某关键字附近前3行及后3行的日志
[root@localhost /]# cat nohup.out | grep -A 3 -B 3 token
查看服务进程
[root@localhost /]# ps -ef | grep mysql
kill进程(pid可通过ps方式查询到)
[root@localhost /]# kill -9 16587
创建目录
[root@localhost /]# mkdir folder
无确认递归删除目录及内容
[root@localhost /]# rm -rf folder
移动或修改文件或文件名
[root@localhost /]# mv folderSource folderTarget
压缩某个目录
[root@localhost /]# tar -zcvf folder.tar.gz folder
解压某个目录
[root@localhost /]# tar -zxvf folder.tar.gz folder
压缩目录时剔除部分目录
[root@localhost /]# tar -zcvf folder.tar.gz folder --exclude=folder/logs
断点续传下载文件
[root@localhost /]# wget -c http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.4.tgz
重启机器
[root@localhost /]# shutdown -r now
查看执行命令的历史
[root@localhost /]# history
赋予文件部分权限
[root@localhost /]# chmod 777 /home/folder/*.sh
查找文件删除时未释放的进程
[root@localhost /]# lsof | grep delete
未完待续。
感谢你浏览此文,欢迎交流。勿喷,你没给钱我也不欠你的。
shell命令执行环境:CentOS 6.5,Linux下基本通用,写的都是服务器运维用得上的,注意触类旁通。
yum的方式安装软件
[root@localhost /]# yum -y install lsb
yum的方式卸载软件
[root@localhost /]# yum -y remove lsb
操作系统更新
[root@localhost /]# yum update -y
查看系统内核及版本
[root@localhost /]# lsb_release -a
查看机器IP及网络状态
[root@localhost /]# ifconfig
查看系统当前时间
[root@localhost /]# date -R
同步系统时间
[root@localhost /]# ntpdate cn.ntp.org.cn
查询命令的用法
[root@localhost /]# man date
查看磁盘分区信息
[root@localhost /]# fdisk -l
查看磁盘使用情况
[root@localhost /]# df -hl
查看当前目录下文件所占的磁盘空间
[root@localhost /]# du -sh *
查看系统负载
[root@localhost /]# top
查看系统内存使用情况
[root@localhost /]# free -m
清除当前屏幕
[root@localhost /]# clear
定位到指定目录
[root@localhost /]# cd /home
显示目录下的文件信息
[root@localhost /]# ll
从根目录查找文件
[root@localhost /]# find / -name info.log
从文件尾部滚动读取文件并过滤关键字
[root@localhost /]# tail -f nohup.out | grep token
查看某关键字附近前3行及后3行的日志
[root@localhost /]# cat nohup.out | grep -A 3 -B 3 token
查看服务进程
[root@localhost /]# ps -ef | grep mysql
kill进程(pid可通过ps方式查询到)
[root@localhost /]# kill -9 16587
创建目录
[root@localhost /]# mkdir folder
无确认递归删除目录及内容
[root@localhost /]# rm -rf folder
移动或修改文件或文件名
[root@localhost /]# mv folderSource folderTarget
压缩某个目录
[root@localhost /]# tar -zcvf folder.tar.gz folder
解压某个目录
[root@localhost /]# tar -zxvf folder.tar.gz folder
压缩目录时剔除部分目录
[root@localhost /]# tar -zcvf folder.tar.gz folder --exclude=folder/logs
断点续传下载文件
[root@localhost /]# wget -c http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.4.tgz
重启机器
[root@localhost /]# shutdown -r now
查看执行命令的历史
[root@localhost /]# history
赋予文件部分权限
[root@localhost /]# chmod 777 /home/folder/*.sh
查找文件删除时未释放的进程
[root@localhost /]# lsof | grep delete
未完待续。
感谢你浏览此文,欢迎交流。勿喷,你没给钱我也不欠你的。
相关文章推荐
- Berkeley DB XML Shell常用命令使用实例
- 常用shell脚本命令总结(添加中。。。)
- 常用shell命令参数(高级)
- [Linux]shell命令的常用快捷键(转)
- Shell中的grep、awk和sed的常用命令和语法
- 常用Shell命令用法(1)
- CentOS下常用配置文件和命令以及目录结构备注
- Linux的shell功能和变量常用命令.八
- shell(10) 常用命令.doc
- shell常用命令
- Shell中的grep、awk和sed的常用命令和语法
- 吐血贡献我常用的shell命令
- 几个常用SHELL命令
- Shell常用命令[转]
- shell及常用命令介绍
- [linux.admin.shell] find命令常用法
- Shell中的grep、awk和sed的常用命令和语法
- Shell常用命令整理
- Linux/CentOS 常用命令集
- 0407 常用Shell命令