linux常用命令(配置查看,定时任务)

1.查看所有待挂载设备信息

fdisk -l

# fdisk -l

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00002f03

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   226170879   113084416   83  Linux
/dev/sda2       226172926   234440703     4133889    5  Extended
/dev/sda5       226172928   234440703     4133888   82  Linux swap / Solaris

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x3025e656

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   614402047   307200000    7  HPFS/NTFS/exFAT
/dev/sdb2       614402048  1228802047   307200000    7  HPFS/NTFS/exFAT
/dev/sdb3      1228802048  1953519615   362358784    7  HPFS/NTFS/exFAT

2.查看cpu信息

cat /proc/cpuinfo

processor    : 0
vendor_id    : GenuineIntel
cpu family    : 6
model        : 60
model name    : Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz
stepping    : 3
microcode    : 0x19
cpu MHz        : 3443.429
cache size    : 6144 KB
physical id    : 0
siblings    : 4
core id        : 0
cpu cores    : 4
apicid        : 0
initial apicid    : 0
fdiv_bug    : no
f00f_bug    : no
coma_bug    : no
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm
bogomips    : 6796.22
clflush size    : 64
cache_alignment    : 64
address sizes    : 39 bits physical, 48 bits virtual
power management:

processor    : 1
vendor_id    : GenuineIntel
cpu family    : 6
model        : 60
model name    : Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz
stepping    : 3
microcode    : 0x19
cpu MHz        : 3399.601
cache size    : 6144 KB
physical id    : 0
siblings    : 4
core id        : 1
cpu cores    : 4
apicid        : 2
initial apicid    : 2
fdiv_bug    : no
f00f_bug    : no
coma_bug    : no
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm
bogomips    : 6796.22
clflush size    : 64
cache_alignment    : 64
address sizes    : 39 bits physical, 48 bits virtual
power management:

processor    : 2
vendor_id    : GenuineIntel
cpu family    : 6
model        : 60
model name    : Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz
stepping    : 3
microcode    : 0x19
cpu MHz        : 3400.000
cache size    : 6144 KB
physical id    : 0
siblings    : 4
core id        : 2
cpu cores    : 4
apicid        : 4
initial apicid    : 4
fdiv_bug    : no
f00f_bug    : no
coma_bug    : no
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm
bogomips    : 6796.22
clflush size    : 64
cache_alignment    : 64
address sizes    : 39 bits physical, 48 bits virtual
power management:

processor    : 3
vendor_id    : GenuineIntel
cpu family    : 6
model        : 60
model name    : Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz
stepping    : 3
microcode    : 0x19
cpu MHz        : 3400.000
cache size    : 6144 KB
physical id    : 0
siblings    : 4
core id        : 3
cpu cores    : 4
apicid        : 6
initial apicid    : 6
fdiv_bug    : no
f00f_bug    : no
coma_bug    : no
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm
bogomips    : 6796.22
clflush size    : 64
cache_alignment    : 64
address sizes    : 39 bits physical, 48 bits virtual
power management:

3.查看内存信息

cat /proc/meminfo

cat /proc/meminfo
MemTotal:        4090736 kB
MemFree:         1628156 kB
MemAvailable:    2270864 kB
Buffers:            7984 kB
Cached:           991184 kB
SwapCached:            0 kB
Active:          1458132 kB
Inactive:         838020 kB
Active(anon):    1102336 kB
Inactive(anon):   377500 kB
Active(file):     355796 kB
Inactive(file):   460520 kB
Unevictable:          32 kB
Mlocked:              32 kB
HighTotal:       3227012 kB
HighFree:        1084212 kB
LowTotal:         863724 kB
LowFree:          543944 kB
SwapTotal:       4133884 kB
SwapFree:        4133884 kB
Dirty:               308 kB
Writeback:             0 kB
AnonPages:       1297060 kB
Mapped:           605736 kB
Shmem:            182856 kB
Slab:              53976 kB
SReclaimable:      30016 kB
SUnreclaim:        23960 kB
KernelStack:        4592 kB
PageTables:        16260 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     6179252 kB
Committed_AS:    6168352 kB
VmallocTotal:     122880 kB
VmallocUsed:       52824 kB
VmallocChunk:      61204 kB
AnonHugePages:    520192 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      378872 kB
DirectMap2M:      530432 kB

4.硬盘速度测试

hdparm -Tt /dev/sda1

# hdparm -Tt /dev/sda1

/dev/sda1:
 Timing cached reads:   22580 MB in  2.00 seconds = 11305.77 MB/sec
 Timing buffered disk reads: 1094 MB in  3.01 seconds = 363.90 MB/sec

5.cron执行定时任务

  crontab -l查看定时任务列表

  crontab -e 编辑定时任务

  5.1简单的定时任务编辑示范

  crontab -e

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use ‘*‘ in these fields (for ‘any‘).#
# Notice that tasks will be started based on the cron‘s system
# daemon‘s notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command###每隔一分钟输出时间到文件
*/2 * * * * echodate >> $HOME>test.txt 

  5.2 查看定时任务列表

  crontab -l

# crontab -l
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use ‘*‘ in these fields (for ‘any‘).#
# Notice that tasks will be started based on the cron‘s system
# daemon‘s notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
*/2 * * * * date >> $HOME>test.txt

  5.3查看定时任务运行效果

  tail -f ~/test.txt

 tail -f ~/test.txt
2015年 10月 02日 星期五 10:24:01 CST
2015年 10月 02日 星期五 10:26:01 CST
2015年 10月 02日 星期五 10:28:01 CST
2015年 10月 02日 星期五 10:30:01 CST

  5.4 crontab补充

    5.4.1 开启corntab 服务  /etc/init.d/cron start

    5.4.2 开机启动corntab

    vim /etc/rc.local 添加需要启动的服务

    例如

  

#!/bin/sh -e
#
# rc.local
#
# when machine startup, blow scripts will run.
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
export HISTTIMEFORMAT="%Y-%m-%d %H:%i:%S `whoami` "
exit 0
~                                                

时间: 2024-08-06 11:32:07

linux常用命令(配置查看,定时任务)的相关文章

linux常用命令 、查看日志、web排查

linux常用命令 ps aux|grep xxx (比如 ps aux|grep tomcat ps aux|grep tomcat-portalvip ps aux|grep nginx 等) rpm -qa|grep xxx (查找系统有没有安装 比如 rpm -qa|grep mysql rpm -qa|grep MySQL rpm -qa|grep jdk 等) 强制卸载 rpm -e 上一步查找结果的内容 --nodeps 查看端口是否被占用 netstat -an|grep 端口

Linux常用命令-文本查看篇

前言 Linux常用命令中,除了cat还有很多其他用于文本查看的命令.本文将简单介绍一下这些文本查看的命令. 全文本显示--cat cat可能是常用的一个文本查看命令了,使用方法也很简单: cat file  #全文本显示在终端cat -n file #显示全文本,并显示行号 另外,cat也可用作合并文件: cat file1 file2 >file3 该命令将file1 file2的内容合并写到file3中. 倒序显示全文本--tac tac是cat倒过来的写法,tac以行为单位,倒序显示全文

Linux常用命令(三)查看当前计算机各方面信息

1.查看cpu: top 2.查看当前linux版本:name -a 查看当前运行的内核版本:cat /pro/version 查看发行版本信息:cat /etc/issue 查看上面所有信息:lsb_release -a 3.查看linux下的系统盘:df -l 原文地址:https://www.cnblogs.com/Jomini/p/8969929.html

linux 常用命令 zcat 查看压缩文件中内容

zcat的用处是可以在不用解压压缩文件就可以查看文件内的内容 有时候log文件众多,为了减少存储空间就会将log文件压缩,这是zcat就可以查看压缩文件内容. -S:指定gzip格式的压缩包的后缀.当后缀不是标准压缩包(zip)后缀时使用此选项: -c:将文件内容写到标注输出: -d:执行解压缩操作: -l:显示压缩包中文件的列表: -L:显示软件许可信息: -q:禁用警告信息: -r:在目录上执行递归操作: -t:测试压缩文件的完整性: -V:显示指令的版本信息: -l:更快的压缩速度: -9

Linux常用命令_(文件查看)

文件查看主要有以下命令 cat.more.less.head.tail cat命令:是一个文本文件查看和连接工具.从第一个字节开始正向查看文件的内容,适用于小文件 以第一行开始,显示没有停顿,文件较长的话,只能看到最后一页内容在屏幕上 当文件内容过多时,就带来一个问题,因为文本在屏幕上迅速地闪过,用户来不及看清其内容.因此,当文件内容较大时,一般可用more等命令分屏显示,以免因屏幕滚动太快而无法看清. 说明:把档案串连接后传到基本输出(屏幕或加 > fileName 到另一个档案) 主要参数:

Linux 常用命令汇总

Linux 常用命令汇总 1. 显示日期与时间:date 可修改显示日期格式,如:date +%Y/%m/%d %H:%M à2016/12/25 17:05(%Y:年:%m:月:%d:日:%H:24小时制:%M:分) date –d 参数后可加:today/yesterday/tomorrow 来显示今天.昨天.明天日期 2. 显示日历:cal(默认显示本月月历) cal 2001 可显示2001年整年日历:cal 10 2001 可具体显示某月月历 3.  计算器:bc 4. Tab键:用在

Linux常用命令大全

系统信息 arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2) uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统部件 - (SMBIOS / DMI) hdparm -i /dev/hda 罗列一个磁盘的架构特性 hdparm -tT /dev/sda 在磁盘上执行测试性读取操作 cat /proc/cpuinfo 显示CPU info的信息 cat /proc/interrupts 显示中断 cat /proc/meminfo 校验

(转)linux常用命令

原地址:http://www.cnblogs.com/svage/p/3700122.html 1.删除目录及子目录下的 .svn目录 find . -type d -name ".svn" | xargs rm -rf 2./tmp 目录的权限 drwxrwxrwt rwt的意思是:对目录有执行权限,但不能删除,即sticky bit rwx : 可读可写可执行 4+2+1 3.改变群组.用户.权限 chgrp   群组名   改变的目录 groupadd -g gid gname

linux常用命令技巧

原文地址 这篇文章来源于Quroa的一个问答<What are some time-saving tips that every Linux user should know?>-- Linux用户有哪些应该知道的提高效率的技巧.我觉得挺好的,总结得比较好,把其转过来,并加了一些自己的理解. 首先,我想告诉大家,在Unix/Linux下,最有效率技巧的不是操作图形界面,而是命令行操作,因为命令行意味着自动化.如果你看过<你可能不知道的Shell>以及<28个Unix/Linu