码迷,mamicode.com
首页 > 系统相关 > 详细

linux系统日常维护常用命令

时间:2019-01-12 22:56:32      阅读:282      评论:0      收藏:0      [点我收藏+]

标签:get   inux   dev   cores   mnt   ++   bit   sso   tab   

环境:
OS:Red Hat Linux As 5
 
1.find
11.查找当前目录以及子目录下包含ORA字符的文件
find . -type f|xargs  grep "ORA"

2.查看当前目录占用空间大小
[root@localhost soft]# pwd
/soft
[root@localhost soft]# du -sh
6.9G    .

查看某个目录占用空间大小
[root@localhost soft]# du /bak -sh

3.mount光驱
[root@localhost soft]# mount /dev/cdrom /mnt

4.图形界面查看启动的服务
ntsysv

5.查看当前安装的服务
system-config-services

6.切换用户
su - 用户名 -- 切换后使用切换后用户名的环境bash_profile
su  用户名  -- 切换后使用当前用户的bash_profile
  
7.scp
将本机上的文件传输到192.168.50.192机器上的soft目录下
scp "/u01/soft/linux_11gR2_database_1of2(1).zip" root@192.168.50.192:/u01/soft/
scp "/u01/soft/linux_11gR2_database_2of2(1).zip" root@192.168.50.192:/u01/soft/

8.tar

tar -cvf /u01/soft/Server.tar ./Server  将Server目录下的文件打包成为Server.tar
tar cvf rpm.tar -P ./rpm                P 使用相对路径,对应解压的命令 tar -Pxvf rpm.tar
tar rvf rpm.tar a.txt                   将a.txt 追加到rpm包中
tar xvf rpm.tar -C /soft/mytest/test    将rpm包解压到指定目录

9.rpm
rpm -Uvh gcc-c++-4.1.2-50.el5.i386.rpm --force --nodeps --强制安装,不需要依赖关系
 
 
10.查看目录占用空间大小
[cx001@nj-sjnlfx04 self]$ du -h ./20160807
36K     ./20160807/17
44K     ./20160807/14
36K     ./20160807/18
36K     ./20160807/16
36K     ./20160807/13
40K     ./20160807/15
592M    ./20160807/12
593M    ./20160807
 
11.查找目录下一个小时之前生成的文件
find /home/logs/1_mmlogs/mmlog_7711/self/20160825 -cmin +60|xargs ls -1
 
12.查看指定目录下第一层级目录占用空间大小
du -lh --max-depth=1 /app/richdm

13.测试磁盘速度
hdparm -Tt /dev/mapper/vg_mmskd-lv_mmsdk
time cp -Rp MB.dat /mmsdk
 
14.替换文件内容sed
sed ‘s/auth_user/auth_user01/g‘ dump0605.sql>a.sql

15.查看一级目录占用空间情况
du -h ./db --max-depth=1  


16.压缩/解压缩
压缩命令
gzip schema_bak20181119.dmp
解压
gunzip schema_bak20181119.dmp.gz



------------------------------CPU相关--------------------------------

几个cpu

more /proc/cpuinfo |grep "physical id"|uniq|wc -l

每个cpu是几核(假设cpu配置相同)

more /proc/cpuinfo |grep "physical id"|grep "0"|wc -l

cat /proc/cpuinfo | grep processor

1. 查看物理CPU的个数
#cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l
 
2. 查看逻辑CPU的个数
#cat /proc/cpuinfo |grep "processor"|wc -l
 
3. 查看CPU是几核
#cat /proc/cpuinfo |grep "cores"|uniq
 
4. 查看CPU的主频
#cat /proc/cpuinfo |grep MHz|uniq

 

uname -a

Linux euis1 2.6.9-55.ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686 i686 i386 GNU/Linux

(查看当前操作系统内核信息)

 

cat /etc/issue | grep Linux

Red Hat Enterprise Linux AS release 4 (Nahant Update 5)

(查看当前操作系统发行版信息)

 

cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c

      8  Intel(R) Xeon(R) CPU            E5410   @ 2.33GHz

(看到有8个逻辑CPU, 也知道了CPU型号)

 

cat /proc/cpuinfo | grep physical | uniq -c

      4 physical id      : 0

      4 physical id      : 1

(说明实际上是两颗4核的CPU)

 

getconf LONG_BIT

32

(说明当前CPU运行在32bit模式下, 但不代表CPU不支持64bit)

 

cat /proc/cpuinfo | grep flags | grep ‘ lm ‘ | wc -l

8

(结果大于0, 说明支持64bit计算. lm指long mode, 支持lm则是64bit)

  

如何获得CPU的详细信息:

linux命令:cat /proc/cpuinfo

用命令判断几个物理CPU,几个核等:

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

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

每个物理CPU中Core的个数:
# cat /proc/cpuinfo | grep "cpu cores" | wc -l

是否为超线程?
如果有两个逻辑CPU具有相同的”core id”,那么超线程是打开的。

每个物理CPU中逻辑CPU(可能是core, threads或both)的个数:
# cat /proc/cpuinfo | grep "siblings"

 

linux系统日常维护常用命令

标签:get   inux   dev   cores   mnt   ++   bit   sso   tab   

原文地址:https://www.cnblogs.com/hxlasky/p/10261174.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!