作者:书友52745226 | 来源:互联网 | 2023-09-23 09:33
一、打包压缩知识点:tar-zxvf-CPATHtar-jxvftar-zcvftar-jcvftar:打包命令-z打包同时gzip压缩-j打包同时bzip2-c打包-x解压-v
一、打包压缩
知识点:
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-01 temp]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000adb00
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 2089 16571392 83 Linux
/dev/sda3 2089 2611 4194304 82 Linux swap / Solaris
[root@beifeng-hadoop-01 temp]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 16G 4.7G 11G 32% /
tmpfs 491M 232K 491M 1% /dev/shm
/dev/sda1 194M 29M 156M 16% /boot
/dev/sr0 4.1G 4.1G 0 100% /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-01 /]# whereis touch
touch: /bin/touch /usr/share/man/man1p/touch.1p.gz /usr/share/man/man1/touch.1.gz
[root@beifeng-hadoop-01 /]# rpm -qf /bin/touch
coreutils-8.4-19.el6.x86_64
(2)
rpm -qa
[root@beifeng-hadoop-01 /]# rpm -qa | grep bind
bind-9.8.2-0.17.rc1.el6.x86_64
bind-utils-9.8.2-0.17.rc1.el6.x86_64
ypbind-1.20.4-30.el6.x86_64
samba-winbind-3.6.9-151.el6.x86_64
rpcbind-0.2.0-11.el6.x86_64
samba-winbind-clients-3.6.9-151.el6.x86_64
bind-libs-9.8.2-0.17.rc1.el6.x86_64
PackageKit-device-rebind-0.5.8-21.el6.x86_64
(3)
[root@beifeng-hadoop-01 Packages]# pwd
/media/CentOS_6.4_Final/Packages
[root@beifeng-hadoop-01 Packages]# ll | grep bind
-r--r--r--. 2 beifeng beifeng 4157992 Feb 23 2013 bind-9.8.2-0.17.rc1.el6.x86_64.rpm
-r--r--r--. 2 beifeng beifeng 71924 Feb 23 2013 bind-chroot-9.8.2-0.17.rc1.el6.x86_64.rpm
-r--r--r--. 2 beifeng beifeng 70056 Feb 23 2013 bind-dyndb-ldap-2.3-2.el6.x86_64.rpm
-r--r--r--. 2 beifeng beifeng 902940 Feb 23 2013 bind-libs-9.8.2-0.17.rc1.el6.i686.rpm
-r--r--r--. 2 beifeng beifeng 891916 Feb 23 2013 bind-libs-9.8.2-0.17.rc1.el6.x86_64.rpm
-r--r--r--. 2 beifeng beifeng 186068 Feb 23 2013 bind-utils-9.8.2-0.17.rc1.el6.x86_64.rpm
-r--r--r--. 2 beifeng beifeng 97700 Feb 23 2013 PackageKit-device-rebind-0.5.8-21.el6.x86_64.rpm
-r--r--r--. 2 beifeng beifeng 52436 Feb 23 2013 rpcbind-0.2.0-11.el6.x86_64.rpm
-r--r--r--. 2 beifeng beifeng 386232 Feb 23 2013 samba4-winbind-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r--. 2 beifeng beifeng 103068 Feb 23 2013 samba4-winbind-clients-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r--. 2 beifeng beifeng 16808 Feb 23 2013 samba4-winbind-krb5-locator-4.0.0-55.el6.rc4.x86_64.rpm
-r--r--r--. 2 beifeng beifeng 2259544 Feb 23 2013 samba-winbind-3.6.9-151.el6.x86_64.rpm
-r--r--r--. 2 beifeng beifeng 2112232 Feb 23 2013 samba-winbind-clients-3.6.9-151.el6.i686.rpm
-r--r--r--. 2 beifeng beifeng 2114016 Feb 23 2013 samba-winbind-clients-3.6.9-151.el6.x86_64.rpm
-r--r--r--. 2 beifeng beifeng 52960 Feb 23 2013 ypbind-1.20.4-30.el6.x86_64.rpm
rpm -ivh bind-9.8.2-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-01 Packages]# yum list installed | grep httpd-devel
httpd-devel.x86_64 2.2.15-53.el6.centos
(3)
yum install httpd-devel
(4)
(5)
五、Shell编程
1.
2.
3.
touch 修改文件
touch -d "20 days ago " /backup/abc.log
4. crontab
/: 每
,: 分别,枚举