1、Zip
zip -r myfile.zip ./*
将当前目录下的所有文件和文件夹全部压缩成myfile.zip文件,-r表示递归压缩子目录下所有文件.
2、unzip
unzip -o -d /home/sunny myfile.zip
把myfile.zip文件解压到 /home/su[……]
1、Zip
zip -r myfile.zip ./*
将当前目录下的所有文件和文件夹全部压缩成myfile.zip文件,-r表示递归压缩子目录下所有文件.
2、unzip
unzip -o -d /home/sunny myfile.zip
把myfile.zip文件解压到 /home/su[……]
1、基本概念
crontab命令常见于Unix和类Unix的操作系统之中,用于设置周期性被执行的指令。该命令从标准输入设备读取指令,并将其存放于“crontab”文件中,以供之后读取和执行。crontab储存的指令被守护进程激活, crond常常在后台运行,每一分钟检查是否有预定的作业需要执行。这类作业一般称为cron jobs。
2、命令格式
1 2 3 4 5 6 7 8 | # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed |
2.1、每月每天每小时的第 0 分钟执行一次 xxoo
0 * * * * xxoo
2.2、在 12 月份期间, 每天的早上 6 点到 12 点中,每隔 20 分钟执行一次 xxoo
*/20 6-12 * 12 * xxoo
2.3、周一到周五每天下午 5:00 xxoo
0 17 * * 1-5 xxoo
2.4、每月每天的午夜 0 点 20 分, 2 点 20 分, 4 点 20 分 xxoo
20 0-23/2 * * * xxoo
3、基本操作[……]
1、 查看新磁盘信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | [root@Crayfish ~]# fdisk -l Disk /dev/xvda: 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: 0x00060953 Device Boot Start End Blocks Id System /dev/xvda1 * 1 2611 20970496 83 Linux Disk /dev/xvdb: 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: 0x00000000 |
2、硬盘分区
2.1、进入fdisk模式
1 2 3 4 5 6 7 8 9 10 11 | [root@Crayfish ~]# fdisk /dev/xvdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0xc233737d. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). |
2.2、输入n进行分区
[……]
1、连接Mysql
1 | mysql -h主机地址 -u用户名 -p用户密码 |
2、修改密码
1 | mysqladmin -u用户名 -p旧密码 password 新密码 |
3、增加新用户
1 | grant select on 数据库.* to 用户名@登录主机 identified by “密码” |
4、创建数据库
注意:创建数据库之前要先连接Mysql服务器
1 | create database <数据库名> |
例1:建立一个名为xhkdb的数据库
1 | mysql> create database xhkdb; |
例2:创建数据库并分配用户
1 2 3 4 5 | ①CREATE DATABASE 数据库名; ②GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON 数据库名.* TO 数据库名@localhost IDENTIFIED BY '密码'; ③SET PASSWORD FOR '数据库名'@'localhost' = OLD_PASSWORD('密码'); |
依次执行3个命令完成数据库创建。注意:中文 “密码”和“数据库”是户自己需要设置的。
5、显示数据库[……]
Linux下没有类似Windows的可视化窗口来查看当前设备硬件资源使用情况,但通过命令行一样能够了解到我们需要的信息,使用top命令
1 2 | [root@Crayfish ~]# top top - 17:17:36 up 0 min, 1 user, load average: 0.20, 0.0[......]<p class="read-more"><a href="https://www.yusian.com/blog/centos/2015/05/14/171950655.html">继续阅读</a></p> |