一、打包压缩
知识点:
tar -zxvf -C PATH
tar -jxvf
tar -zcvf
tar -jcvf
tar:打包命令
-z 打包同时gzip压缩
-j 打包同时bzip2
-c 打包
-x 解压
-v 显示过程信息
-f 对普通文件进行操作
-C 指定解压路径
-t 查看包内容
(1)tar -zcvf `date +"%Y_%m_%d"`etc.tar.gz /etc
(2)tar -zxvf 2016_07_01etc.tar.gz -C /tmp
(3)tar -tvf 2016_07_01etc.tar.gz
二、磁盘分区
(1)
[root@beifeng-hadoop- temp]# fdisk -l Disk /dev/sda: 21.5 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x000adb00 Device Boot Start End Blocks Id System
/dev/sda1 * Linux
Partition does not end on cylinder boundary.
/dev/sda2 Linux
/dev/sda3 Linux swap / Solaris
[root@beifeng-hadoop- temp]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 16G .7G 11G % /
tmpfs 491M 232K 491M % /dev/shm
/dev/sda1 194M 29M 156M % /boot
/dev/sr0 .1G .1G % /media/CentOS_6.4_Final
fdisk /dev/sdc
[root@beifeng-hadoop-01 /]# mkdir -p /data/primary
[root@beifeng-hadoop-01 /]# mkdir -p /data/logic
[root@beifeng-hadoop-01 /]# chown -R 777 /data/primary/
[root@beifeng-hadoop-01 /]# chown -R 777 /data/logic/
(2)
mkfs.ext4 /dev/sdc1
mount /dev/sdc1 /data/primary/
df -h
lost+found 用于磁盘恢复,一般没什么用
(3)
fdisk /dev/sdc
n
2
+5G
p
n
l
p
sdc1 sdc2 sdc3 sdc4
sdc5
mkfs.ext3 /dev/sdc5
6.0 以前 partprobe /dev/sdc5 平滑刷新整个分区结构
partx -a /dev/sdc5
重启后格式化
mkfs.ext3 /dev/sdc5
mount /dev/sdc5 /data/logic/
vim /etc/fstab
:x 保存退出
(4)
vi /etc/fstab
/dev/sdc1 /data/ primary ext4 dafaults 0 0
三、RPM包
(1)
[root@beifeng-hadoop- /]# whereis touch
touch: /bin/touch /usr/share/man/man1p/touch.1p.gz /usr/share/man/man1/touch..gz
[root@beifeng-hadoop- /]# rpm -qf /bin/touch
coreutils-8.4-.el6.x86_64
(2)
rpm -qa
[root@beifeng-hadoop- /]# rpm -qa | grep bind
bind-9.8.-0.17.rc1.el6.x86_64
bind-utils-9.8.-0.17.rc1.el6.x86_64
ypbind-1.20.-.el6.x86_64
samba-winbind-3.6.-.el6.x86_64
rpcbind-0.2.-.el6.x86_64
samba-winbind-clients-3.6.-.el6.x86_64
bind-libs-9.8.-0.17.rc1.el6.x86_64
PackageKit-device-rebind-0.5.-.el6.x86_64
(3)
[root@beifeng-hadoop- Packages]# pwd
/media/CentOS_6.4_Final/Packages
[root@beifeng-hadoop- Packages]# ll | grep bind
-r--r--r--. beifeng beifeng Feb bind-9.8.-0.17.rc1.el6.x86_64.rpm
-r--r--r--. beifeng beifeng Feb bind-chroot-9.8.-0.17.rc1.el6.x86_64.rpm
-r--r--r--. beifeng beifeng Feb bind-dyndb-ldap-2.3-.el6.x86_64.rpm
-r--r--r--. beifeng beifeng Feb bind-libs-9.8.-0.17.rc1.el6.i686.rpm
-r--r--r--. beifeng beifeng Feb bind-libs-9.8.-0.17.rc1.el6.x86_64.rpm
-r--r--r--. beifeng beifeng Feb bind-utils-9.8.-0.17.rc1.el6.x86_64.rpm
-r--r--r--. beifeng beifeng Feb PackageKit-device-rebind-0.5.-.el6.x86_64.rpm
-r--r--r--. beifeng beifeng Feb rpcbind-0.2.-.el6.x86_64.rpm
-r--r--r--. beifeng beifeng Feb samba4-winbind-4.0.-.el6.rc4.x86_64.rpm
-r--r--r--. beifeng beifeng Feb samba4-winbind-clients-4.0.-.el6.rc4.x86_64.rpm
-r--r--r--. beifeng beifeng Feb samba4-winbind-krb5-locator-4.0.-.el6.rc4.x86_64.rpm
-r--r--r--. beifeng beifeng Feb samba-winbind-3.6.-.el6.x86_64.rpm
-r--r--r--. beifeng beifeng Feb samba-winbind-clients-3.6.-.el6.i686.rpm
-r--r--r--. beifeng beifeng Feb samba-winbind-clients-3.6.-.el6.x86_64.rpm
-r--r--r--. beifeng beifeng Feb ypbind-1.20.-.el6.x86_64.rpm
rpm -ivh bind-9.8.-0.17.rc1.el6.x86_64.rpm
(4)
rpm -ql bind
四、yum命令
安装软件3种方式
rpm/yum/make install
(1)
yum list installed
(2)
[root@beifeng-hadoop- Packages]# yum list installed | grep httpd-devel
httpd-devel.x86_64 2.2.-.el6.centos
(3)
yum install httpd-devel
(4)
(5)
五、Shell编程
1.
2.
3.
touch 修改文件
touch -d "20 days ago " /backup/abc.log
4. crontab
/: 每
,: 分别,枚举