date 显示当前系统时间
date -u 显示格林威治时间
date +%y-%m-%d 格式化显示当前时间
date -s "20:20:15" 修改时间(需要root权限)
clock 查看硬件时钟时间(同hwclock)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | [jiel@jiel /]$ date Sat May 25 15:08:16 CST 2013 [jiel@jiel /]$ date -u Sat May 25 07:11:36 UTC 2013 [jiel@jiel /]$ date +%y-%m-%d 13-05-25 [jiel@jiel /]$ su Password: [root@jiel /] # date -s 16:16:16 Sat May 25 16:16:16 CST 2013 [root@jiel /] # date Sat May 25 16:16:18 CST 2013 [root@localhost /] # clock Sat 25 May 2013 03:19:38 PM CST -0.473705 seconds [2] Done sleep 5000 [root@localhost /] # hwclock Sat 25 May 2013 03:19:47 PM CST -0.027284 seconds [root@localhost /] # |
cal 查看系统日历
1 2 3 4 5 6 7 8 | [root@jiel ~] # cal
May 2013 Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
uptime 查看系统运行时间
1 2 3 | [root@jiel ~] # uptime
15:21:47 up 2:44, 4 users , load average: 0.00, 0.00, 0.00 [root@jiel ~] # |
echo 输出内容
1 2 3 | [root@jiel ~] # echo skdjkjafjsdkjflksjjldkf skdjkjafjsdkjflksjjldkf [root@jiel ~] # |
head name 显示文件前10行
head -n 5 name 显示文件前5行
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | [root@jiel ~] # head anaconda-ks.cfg # Kickstart file automatically generated by anaconda.
install cdrom lang en_US.UTF-8 keyboard us xconfig --startxonboot network --device eth0 --bootproto dhcp network --device eth1 --bootproto dhcp rootpw --iscrypted $1$9yCBsYkJ$IqSx /Gj .pUgRs6vm.6UjM0 [root@jiel ~] # head -n 5 anaconda-ks.cfg # Kickstart file automatically generated by anaconda.
install cdrom lang en_US.UTF-8 [root@jiel ~] # |
tail name 同head,显示文件末尾10行
tail -n 5 name 显示文件末尾5行
tail -f name 追踪文件更新,一旦文件有更新就显示更新内容,通常用来查看log文件
less name 翻页显示文件内容,可上下翻页
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | [root@jiel ~] # less anaconda-ks.cfg # Kickstart file automatically generated by anaconda.
install cdrom lang en_US.UTF-8 keyboard us xconfig --startxonboot network --device eth0 --bootproto dhcp network --device eth1 --bootproto dhcp rootpw --iscrypted $1$9yCBsYkJ$IqSx /Gj .pUgRs6vm.6UjM0 firewall --enabled --port=22:tcp authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc Asia /Chongqing bootloader --location=mbr --driveorder=sda --append= "rhgb quiet" # The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work #clearpart --all --drives=sda #part /boot --fstype ext3 --size=100 --ondisk=sda #part pv.7 --size=0 --grow --ondisk=sda #volgroup VolGroup00 --pesize=32768 pv.7 #logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow #logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=1000 --grow --maxsize=4000
(end) |
lspci 查看pci设备信息
lsusb 查看usb设备信息
都可以加 -v 显示详细信息
lsmod 查看加载的驱动等模块
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | [root@localhost /] # lsusb Bus 001 Device 001: ID 0000:0000 Bus 002 Device 001: ID 0000:0000 [root@localhost /] # lsusb -v
Bus 001 Device 001: ID 0000:0000 Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 9 Hub
bDeviceSubClass 0 Unused
bDeviceProtocol 1 Single TT
bMaxPacketSize0 64 ...............................................................
Hub Port Status:
Port 1: 0000.0100 power
Port 2: 0000.0100 power [root@localhost /] # lsmod Module Size Used by autofs4 63049 3 hidp 83649 2 rfcomm 104937 0 .................................................................. |
zip 文件名 要压缩的文件 压缩打包文件
unzip 文件名 解压缩文件
gzip 文件名 直接将次文件压缩
1 2 3 4 5 6 7 8 9 10 | [root@jiel ~] # ls anaconda-ks.cfg Desktop install .log install .log.syslog [root@jiel ~] # zip aaa.zip anaconda-ks.cfg
adding: anaconda-ks.cfg (deflated 44%) [root@jiel ~] # unzip aaa.zip Archive: aaa.zip replace anaconda-ks.cfg? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
inflating: anaconda-ks.cfg [root@jiel ~] # ls aaa.zip anaconda-ks.cfg Desktop install .log install .log.syslog |
tar -cvf 文件名 要归档的文件 创建一个归档文件(tar不会压缩)
tar -xvf 文件名 释放一个归档文件
如果参数加z会调用gzip 代表归档并压缩或解压缩后缀为.tar.gz
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | [root@jiel ~] # tar -cvf jiel.tar /home/jiel tar : Removing leading `/' from member names /home/jiel/ /home/jiel/ .gconf/ /home/jiel/ .gconf /apps/ ............................................................... [root@jiel ~] # ls aaa.zip anaconda-ks.cfg Desktop install .log install .log.syslog jiel. tar [root@jiel ~] # tar -xvf jiel.tar home /jiel/ home /jiel/ .gconf/ home /jiel/ .gconf /apps/ ........................................................ [root@jiel ~] # [jiel@jiel ~]$ ls Desktop firefox-21.0. tar .bz2 ja [jiel@jiel ~]$ tar -cvzf jabackup. tar .gz ja ja/ ja /jiel/ [jiel@jiel ~]$ ls Desktop firefox-21.0. tar .bz2 ja jabackup. tar .gz [jiel@jiel ~]$ tar -xvzf jabackup. tar .gz ja/ ja /jiel/ [jiel@jiel ~]$ ls Desktop firefox-21.0. tar .bz2 ja jabackup. tar .gz [jiel@jiel ~]$ |
locate jiel 查找计算机上所有有jiel的文件名(基于数据库查找)
updatedb 更新locate数据库
1 2 3 4 5 6 7 | [root@jiel ~] # locate jiel /home/jiel /home/jiel/ .ICEauthority /home/jiel/ .Trash /home/jiel/ .bash_history /home/jiel/ .bash_logout /home/jiel/ .bash_profile |
find /home/jiel -name aa* 查找目录下所有以aa开头的文件
find /home/jiel -perm 777 查找目录下所有权限为777的文件
find /home/jiel -type d -name a* 查找目录下所有以a开头的类型是文件的
find /home/jiel -type l -name a* 查找目录下所有以a开头的类型是链接的
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | [jiel@jiel ~]$ find . -name aa* . /aaa [jiel@jiel ~]$ find . -perm 777 [jiel@jiel ~]$ find . -perm 770 [jiel@jiel ~]$ ll total 23896 drwxrwxr-x 2 jiel jiel 4096 May 25 16:07 aaa drwxr-xr-x 2 jiel jiel 4096 May 25 12:12 Desktop -rw-rw-r-- 1 jiel jiel 24410321 May 25 12:29 firefox-21.0. tar .bz2 -rw-rw-r-- 1 jiel jiel 125 May 25 15:56 jabackup. tar .gz [jiel@jiel ~]$ find . -perm 775 . /aaa ./.redhat ./.redhat /esc ./.gstreamer-0.10 ./.gnome ./.gnome /gnome-vfs ./.mozilla /firefox/7hfxc4nf .default /extensions ./.mozilla /firefox/7hfxc4nf .default /Cache ./.mozilla /extensions/ {ec8030f7-c20a-464f-9b0e-13a3a9e97384} [jiel@jiel ~]$ |
dmesg 查看本次开机内核的加载信息
init * 切换到相应级别
init 1 进入单用户模式(自动登录root 且不需要输入密码,不加载任何服务)