shell GC&C
- 格式:pdf
- 大小:84.64 KB
- 文档页数:25
Shell命令⼤全⼀、Linux下常⽤命令:⽂件与⽬录操作basename:从⽂件名中去掉路径和扩展名cd:切换当前⼯作⽬录到指定⽬录chgrp:改变⽂件所属组chmod:改变⽂件的权限chown:改变⽂件的所有者和组cp:复制⽂件或⽬录dd:复制⽂件并转换⽂件内容file:确定⽂件类型find:在指定⽬录下查找⽂件并执⾏指定的操作ln:创建⽂件链接locate/slocate:快速定位⽂件的路径ls/dir/vdir:显⽰⽬录内容mkdir:创建⽬录mv:移动或重命名⽂件pwd:显⽰当前⼯作⽬录rename:重命名⽂件rm:删除⽂件或⽬录rmdir:删除空⽬录touch:修改⽂件的时间属性updatedb:创建或更新slocate数据库whereis:显⽰指令程序、源代码和man⼿册页which:显⽰指令的绝对路径⼆、Linux下常⽤命令:备份与压缩ar:创建、修改归档⽂件和从归档⽂件中提取⽂件arj:.arj⽂件压缩指令bunzip2:压缩bzip2格式的压缩⽂件bzcat:解压缩⽂件到标准输出bzip2:创建.bz2格式的压缩⽂件bzip2recover:修复损坏的.bz2⽂件bzless/bzmore:解压缩.bz2⽂件并分屏显⽰内容compress:压缩数据⽂件cpio:存取归档包中的⽂件dump:⽂件系统备份gunzip:解压缩由gzip压缩的⽂件gzexe:压缩可执⾏程序gzip:GNU的压缩和解压缩⼯具lha:压缩和解压缩指令resotre:还原由dump备份的⽂件或⽂件系统tar:创建备份档案⽂件unarj:解压缩.arj⽂件uncompress:解压缩.Z⽂件unzip:解压缩.zip⽂件zcat:解压缩⽂件并送到标准输出zforce:强制gzip格式的⽂件加上.gz扩展名zip:压缩⽂件zipinfo:显⽰zip压缩⽂件的详细信息znew:将“.Z”⽂件转换成“.gz”⽂件三、Linux下常⽤命令:⽂本处理cat:链接⽂件并显⽰到标准输出cksum:检查和计算⽂件循环冗余校验码cmp:⽐较两个⽂件的差异col:过滤控制字符colrm:从输⼊中过滤掉指定的列comm:⽐较两个有序⽂件的不同csplit:分割⽂件cut:显⽰⽂件中每⾏的指定内容diff3:⽐较3个⽂件的不同diff:⽐较并显⽰两个⽂件的不同diffstat:根据diff指令的结果显⽰统计信息ed:⾏⽂本编辑器emacs:全屏⽂本编辑器ex:⽂本编辑器expand:将Tab转换为空⽩(Space)fmt:最优化⽂本格式fold:设置⽂件显⽰的⾏宽grep/egrep/fgrep:显⽰⽂件中匹配的⾏head:输出⽂件开头部分内容ispell:交互式拼写检查程序jed:⽂本编辑器joe:编辑⽂本⽂件join:合并两个⽂件的相同字段less:分屏查看⽂本⽂件look:显⽰⽂件中以特定字符串开头的⾏more:分屏查看⽂本⽂件od:以数字编码输出⽂件内容paste:合并⽂件的内容pico:⽂本编辑器sed:流⽂件编辑器sort:排序数据⽂件spell:拼写检查split:分割⽂件sum:计算并显⽰⽂件的校验码tac:反序显⽰⽂件内容tail:输出⽂件尾部部分内容tee:将输⼊内容复制到标准输出和指定⽂件tr:转换或删除⽂件中的字符unexpand:将空⽩(Space)转换为Tabuniq:删除⽂件中的重复⾏vi:全屏⽂本编辑器wc:计算⽂件的字节数、单词数和⾏数四、Linux下常⽤命令:shell指令alias:定义命令别名bg:将作业(或任务)放到后台运⾏bind:显⽰或设置键盘配置declare:声明shell变量dirs:显⽰shell⽬录堆栈中的记录echo:打印字符串到标准输出enable:激活与关闭shell内部命令eval:执⾏指定指令并返回结果exec:执⾏给定指令后退出登录exit:退出当前shellexport:设置与显⽰环境变量fc:编辑并执⾏历史命令fg:将后台任务(或作业)切换到前台运⾏hash:显⽰与清除指令时运⾏查询的哈希表history:显⽰与操纵历史命令jobs:显⽰shell的作业信息kill:杀死进程或作业logout:退出登录shellpopd:从shell⽬录堆栈中删除记录pushd:向shell⽬录堆栈中添加记录set:设置shell的执⾏⽅式shopt:设置控制shell⾏为变量的开关值ulimit:设置shell的资源限制umask:设置创建⽂件的权限掩码unalias:取消由alias定义的命令别名unset:删除定义的变量或函数五、Linux下常⽤命令:打印相关指令accept:接受打印请求cancel:取消打印任务disable:停⽌打印机enable:启动打印机lp:打印⽂件lpadmin:配置cups打印机和类lpc:控制打印机lpq:显⽰当前打印队列lpr:打印⽂件lprm:删除当前打印队列中的作业lpstat:显⽰CUPS的状态信息pr:打印前转换⽂本格式reject:拒绝打印请求六、Linux下常⽤命令:其他基础指令bc:实现精确计算的计算器cal:显⽰⽇历clear:清屏指令consoletype:显⽰当前使⽤的终端类型ctrlaltdel:设置热键Ctrl+Alt+Del的功能date:显⽰和设置系统⽇期时间dircolors:设置ls指令显⽰时的颜⾊eject:弹出可移动设备的介质halt:关闭计算机hostid:显⽰当前主机的数字标识hwclock:查询和设置系统硬件时钟info:读取帮助⽂档login:登录系统man:显⽰联机帮助⼿册md5sum:计算并显⽰⽂件的md5摘要信息mesg:设置终端写权限mtools:显⽰mtools软件包的指令mtoolstest:测试并显⽰mtools⼯具包的配置poweroff:关闭计算机并切断电源reboot:重新启动计算机shutdown:关闭计算机sleep:睡眠指定长的时间stat:显⽰⽂件或⽂件系统的状态talk:与其他⽤户交谈wall:向所有终端发送信息whatis:在数据库中查询关键字who:显⽰当前已登录⽤户的信息whoami:显⽰当前⽤户名write:向指定⽤户终端发送信息yes:不断输出指定字符串七、Linux下常⽤命令:⽤户管理chfn:改变⽤户的finger信息chsh:改变⽤户登录时的默认shellfinger:⽤户信息查询程序gpasswd:管理组⽂件/etc/groupgroupadd:创建组groupdel:删除组groupmod:修改组信息groups:显⽰⽤户所属的组grpck:验证组⽂件/etc/group的完整性grpconv:启⽤组的影⼦⼝令⽂件grpunconv:关闭组的影⼦⼝令⽂件logname:显⽰登录⽤户名passwd:设置⽤户密码pwck:验证⽤户⽂件密码⽂件的完整性pwconv:启⽤⽤户的影⼦⼝令⽂件pwunconv:关闭⽤户的影⼦⼝令⽂件su:切换⽤户useradd:创建⽤户userdel:删除⽤户usermod:修改⽤户的配置信息users:显⽰当前登录系统的⽤户名⼋、Linux下常⽤命令:进程管理init:进程初始化控制killall:根据名称结束进程nice:设置进程优先级nohup:以忽略挂起信号⽅式运⾏程序pgrep:基于名字查询并显⽰进程号pidof:查找正在运⾏程序的进程号pkill:向指定的进程发送信号ps:显⽰系统当前的进程状态pstree:⽤树形图显⽰进程的⽗⼦关系renice:调整进程优先级w:显⽰当前登录⽤户的相关信息watch:全屏⽅式显⽰指定命令的输出信息九、Linux下常⽤命令:磁盘与⽂件系统管理badblocks:磁盘坏块检查⼯具blockdev:从命令⾏调⽤块设备的ioctl函数chattr:改变⽂件的第2扩展⽂件系统属性convertquota:转换quota⽂件格式df:报告磁盘剩余空间情况dumpe2fs:显⽰ext2/ext3⽂件系统信息e2fsck:检查ext2/ext3⽂件系统e2image:保存ext2/ext3源数据到⽂件e2label:设置ext2/ext3⽂件系统标签edquota:编辑⽤户的磁盘空间配额fdisk:Linux下的分区⼯具findfs:查找⽂件系统fsck:检查与修复Linux⽂件系统grub:Linux下的引导加载器hdparm:调整硬盘I/O性能lilo:Linux加载器lsattr:显⽰⽂件的ext2⽂件系统属性mkbootdisk:为当前系统创建专门的引导软盘mke2fs:创建第2扩展⽂件系统mkfs:创建各种⽂件系统mkinitrd:创建初始化ram磁盘映像⽂件mkisofs:创建光盘映像⽂件mknod:创建块设备或字符设备⽂件mkswap:创建交换分区⽂件系统mktemp:创建临时⽂件mount:加载⽂件系统parted:磁盘分区管理⼯具quota:显⽰⽤户磁盘配额quotacheck:创建、检查和修复配额⽂件quotaoff:关闭⽂件系统的磁盘配额功能quotaon:打开⽂件系统的磁盘配额功能quotastat:显⽰磁盘配额状态repquota:显⽰⽂件系统磁盘配额信息报表swapoff:关闭交换空间swapon:激活交换空间sync:强制将缓存数据写⼊磁盘tune2fs:调整ext2/ext3⽂件系统的参数umount:卸载已经加载的⽂件系统⼗、Linux下常⽤命令:内核与性能depmod:处理内核可加载模块的依赖关系dmesg:显⽰内核的输出信息free:显⽰内存使⽤情况insmod:加载模块到内核iostat:报告CPU、I/O设备及分区状态ipcs:显⽰进程间通信的状态信息kernelversion:显⽰内核主版本号lsmod:显⽰已加载的模块modinfo:显⽰内核模块信息modprobe:加载内核模块并解决依赖关系mpstat:显⽰进程相关状态信息rmmod:从内核中删除模块sar:收集、显⽰和保存系统活动信息slabtop:实时显⽰内核的slab缓存信息sysctl:运⾏时修改内核参数tload:监视系统平均负载情况top:显⽰和管理系统进程uname:显⽰系统信息uptime:显⽰系统运⾏时间及平均负载vmstat:显⽰虚拟内存的状态⼗⼀、Linux下常⽤命令:X-Window系统startx:初始化X-Window会话xauth:X系统授权许可⽂件管理⼯具xhost:显⽰和配置X服务器的访问权限xinit:X-Window系统初始化程序xlsatoms:显⽰X服务器原⼦数据定义xlsclients:显⽰指定显⽰器上运⾏的X程序xlsfonts:显⽰X服务器使⽤的字体信息xset:设置X系统的⽤户偏爱属性⼗⼆、Linux下常⽤命令:系统安全chroot:以指定根⽬录运⾏指令nmap:⽹络探测⼯具和安全扫描器scp:加密的远程复制⼯具sftp:安全⽂件传输⼯具slogin:加密的远程登录⼯具ssh:加密的远程登录⼯具sudo:以另⼀个⽤户⾝份执⾏指令⼗三、Linux下常⽤命令:编程相关指令awk/gawk:模式扫描与处理语⾔expr:计算表达式的值gcc:GNU的C语⾔编译器gdb:GNU调试器ldd:显⽰共享库依赖make:⼯程编译⼯具nm:显⽰⽬标⽂件的符号表perl:perl语⾔的命令⾏⼯具php:PHP脚本语⾔命令⾏接⼝test:条件测试⼗四、Linux下常⽤命令:其他系统管理与维护指令arch:显⽰当前主机的硬件架构at:按照时间安排任务的执⾏atq:查询待执⾏的任务atrm:删除待执⾏的任务batch:在指定时间运⾏任务chkconfig:设置系统在不同运⾏等级下所执⾏的服务crontab:按照时间设置计划任务last:显⽰以前登录过系统的⽤户相关信息lastb:显⽰登录系统失败的⽤户相关信息logrotate:系统⽇志的轮循⼯具logsave:将命令的输出信息保存到⽇志⽂件logwatch:报告和分析系统⽇志lsusb:显⽰所有的USB设备patch:补丁与更新⽂件rpm:Red Hat软件包管理器runlevel:显⽰当前系统的运⾏等级service:Linux服务管理和控制⼯具telinit:切换当前系统的运⾏等级yum:RPM软件包⾃动化管理⼯具⼗五、Linux下常⽤命令:⽹络配置dnsdomainname:显⽰系统的DNS域名domainname:显⽰和设置主机域名hostname:显⽰或者设置系统主机名ifcfg:配置⽹络接⼝ifconfig:配置⽹络接⼝的⽹络参数ifdown:关闭指定⽹络接⼝ifup:启动指定⽹络接⼝nisdomainname:显⽰和设置主机域名route:显⽰与操纵本机的IP路由表ypdomainname:显⽰和设置主机域名⼗六、Linux下常⽤命令:⽹络测试与应⽤arp:管理本机arp缓冲区arping:向相邻主机发送ARP请求报⽂arpwatch:监听⽹络上的ARP信息dig:域名查询⼯具elinks:纯⽂本⽹页浏览器elm:电⼦邮件客户端程序ftp:⽂件传输协议客户端host:DNS域名查询⼯具ipcalc:IP地址计算器lynx:纯⽂本⽹页浏览器mail:电⼦邮件管理程序ncftp:增强的FTP客户端⼯具netstat:显⽰⽹络状态nslookup:DNS域名查询⼯具pine:电⼦邮件和新闻组处理程序ping:测试到达⽬标主机的⽹络是否通畅rsh:远程shelltelnet:远程登录⼯具tftp:简单⽂件传输协议客户端tracepath:追踪数据经过的路由traceroute:追踪数据包到达⽬的主机经过的路由wget:从指定URL地址下载⽂件⼗七、Linux下常⽤命令:⾼级⽹络指令arptables:管理内核的ARP规则表ip:强⼤的多功能⽹络配置⼯具iptables:IP包过滤与NAT管理⼯具iptables-save:保存内核中iptables的配置iptables-restore:还原iptables的配置信息tcpdump:监听⽹络流量⼗⼋、Linux下常⽤命令:⽹络服务器指令ab:Web服务器性能测试apachectl:Apache HTTP服务器控制接⼝exportfs:管理NFS服务器共享的⽂件系统htdigest:管理⽤于摘要认证的⽤户⽂件htpasswd:管理⽤于基本认证的⽤户⽂件httpd:Apache超⽂本传输协议服务器mailq:显⽰待发送的邮件队列mysql:MySQL服务器的客户端⼯具mysqladmin:MySQL服务器管理⼯具msqldump:MySQL服务器备份⼯具mysqlimport:MySQL数据库导⼊⼯具mysqlshow:显⽰MySQL数据库、表和字段信息nfsstat:显⽰⽹络⽂件系统状态sendmail:电⼦邮件传送代理程序showmount:显⽰NFS服务器上的加载信息smbclient:samba服务器客户端⼯具smbmount:加载samba⽂件系统smbpasswd:改变samba⽤户的密码squid:HTTP代理服务器程序sshd:OpenSSH守护进程。
使用Shell脚本进行性能优化和调优的技巧Shell脚本是一种编程语言,能够通过命令行界面操作和控制计算机系统。
在系统性能优化和调优方面,Shell脚本可以发挥重要作用。
本文将介绍一些使用Shell脚本进行性能优化和调优的技巧,帮助您提高系统的性能和效率。
一、定期清理临时文件临时文件在系统中产生并被使用后往往没有被主动删除,会占用系统的存储空间。
可以编写一个Shell脚本,定期清理指定目录下的临时文件,以释放磁盘空间。
以下是一个示例脚本:```Shell#!/bin/bashTEMP_DIR="/tmp"find "$TEMP_DIR" -type f -mtime +7 -exec rm -f {} \;```该脚本会删除/tmp目录下7天前的所有文件。
您可以根据实际需求更改TEMP_DIR目录和保留文件的时间。
二、优化磁盘读写性能磁盘读写对系统性能有着重要影响。
通过调整I/O调度程序可以改善磁盘读写性能。
以下是一个调整磁盘I/O调度程序的示例脚本:```Shell#!/bin/bashDISK="/dev/sdb"echo deadline > /sys/block/$DISK/queue/scheduler```该脚本将磁盘/dev/sdb的I/O调度程序设置为deadline,可以提高磁盘读写性能。
您可以根据磁盘设备的实际情况进行调整。
三、监控系统性能监控系统性能是评估和优化系统的重要步骤。
通过编写Shell脚本,可以定期收集和记录系统的性能数据。
以下是一个采集系统CPU使用率和内存使用情况的示例脚本:```Shell#!/bin/bashLOG_FILE="/var/log/system_performance.log"echo $(date) >> $LOG_FILEecho "CPU Usage: $(top -bn1 | grep "Cpu(s)" | awk '{print $2 + $4}')" >> $LOG_FILEecho "Memory Usage: $(free -m | awk 'NR==2{print $3}')" >>$LOG_FILE```该脚本会将当前的日期、CPU使用率和内存使用情况记录在/var/log/system_performance.log文件中。
shell-函数之参数使⽤详解参数的调⽤⽅法在其他语⾔中,函数参数分为形参和实参,其中,形参是函数定义时就指定的参数;⽽实参是函数被调⽤时才指定的参数(通常放在括号⾥,参数之间⽤逗号隔开)shell的函数参数⽐较特殊,实际上shell将脚本的参数和函数的参数统⼀处理,怎么调⽤脚本参数就怎么调⽤函数参数。
function_name arg arg1 arg2 ...function_name是函数名,arg表⽰函数参数,通过空格隔开。
通过位置变量接受函数参数和shell脚本相同,shell函数通过系统变量获取参数值。
从命令⾏传递给shell函数的参数叫做位置参数,shell会根据参数的位置来接受对应的值。
在shell内部,⽤户可以通过⼀系列的系统变量来获取参数,这些变量的名称都是固定的,⾮常简单,只⽤⼀个字符表⽰,例如$0表⽰脚本名称;$1表⽰传递的第⼀个参数......常⽤于参数传递的系统变量变量说明$n n是⼀个参数,从1开始表⽰参数的位置,例如:$1表⽰第⼀个参数,$2表⽰第⼆个参数$#命令⾏参数的个数$0当前shell脚本的名称$?前⼀个命令或者是函数的返回状态码,0代表执⾏成功,⾮0即失败$*以”参数1参数2....“的形式将所有函数通过⼀个字符串返回$@以”参数1“”参数2“....的形式返回每个参数$_保存之前执⾏的命令的最后的⼀个参数举个简单的例⼦:#!/bin/bashfunc (){echo "这是第 $2 个参数"echo "这是第 $4 个参数"echo "这是第 $1 个参数"}func 1 2 3 4输出结果为:shift移动位置参数shift命令可以使位置参数向左移。
⽐如shift 3表⽰位置参数$4 向左移动三变成 $1,原来的$5现在变成$2,⽽原来的$1、$2、$3丢弃,** 因为$0是脚本名嘛!**。
•一、App启动速度优化•二、App内存优化•三、App绘制优化•四、App瘦身•五、APP电量优化App启动速度优化一、认识启动加速含义从点击图标到用户可操作的全部过程意义避免用户一安装应用就卸载分类•冷启动•热启动•温启动过程冷启动前•1、点击相应应用图标•2、App启动之后立即展示一个空白的Window(预览窗口显示)•3、创建App进程冷启动后•1、创建App对象•2、启动Main Thread•3、创建启动的Activity对象,闪屏显示•4、创建启动的MainActivity对象,主页显示•5、其它工作二、优化工具力求获取准确的数据评估1、TraceView性能损耗太大,得出的结果并不真实作用:主要做热点分析,得到两种数据•单次执行最耗时的方法•执行次数最多的方法使用:•1、代码中添加:Debug.startMethodTracing()、检测方法、Debug.stopMethodTracing()•2、打开Profile->CPU->点击Record->点击Stop->查看Profile下方Top Down/Bottom Up找出耗时的热点方法。
2、Systrace+函数插桩Systrace原理在系统的一些关键链路(如SystemServcie、虚拟机、Binder驱动)插入一些信息(Label),通过Label的开始和结束来确定某个核心过程的执行时间,然后把这些Label信息收集起来得到系统关键路径的运行时间信息,最后得到整个系统的运行性能信息。
Android Framework里面一些重要的模块都插入了label信息(Java 层通过android.os.Trace类完成, native层通过ATrace宏完成),用户App中可以添加自定义的Lable。
特性•系统版本越高,Android Framework中添加的系统可用Label就越多,能够支持和分析的系统模块也就越多。
shell的基础语法Shell是一种命令行解释器,它允许用户与操作系统进行交互并执行各种操作。
Shell的基础语法包括以下几个方面:1. 命令执行,在Shell中,用户可以直接输入命令来执行各种操作,例如`ls`命令用于列出当前目录下的文件和文件夹,`mkdir`命令用于创建新的目录等。
2. 变量,在Shell中,可以使用变量来存储数据并在需要的时候进行引用。
变量的赋值和引用使用类似于`variable_name=value`和`$variable_name`的语法。
3. 控制结构,Shell支持基本的控制结构,如条件判断和循环。
条件判断使用`if-then-else-fi`语法,而循环则可以使用`for`、`while`等关键字来实现。
4. 函数,Shell中可以定义和调用函数,使用`function_name() { ... }`的语法来定义函数,使用`function_name`来调用函数。
5. 管道和重定向,Shell支持管道和重定向操作,允许用户将一个命令的输出作为另一个命令的输入,或者将命令的输入/输出重定向到文件或其他设备。
6. 通配符,Shell支持通配符来匹配文件名,例如``用于匹配任意字符,`?`用于匹配单个字符等。
7. 注释,在Shell脚本中,可以使用`#`符号来添加注释,注释部分将被解释器忽略。
总的来说,Shell的基础语法包括了命令执行、变量、控制结构、函数、管道和重定向、通配符以及注释等内容。
掌握这些基础语法对于编写Shell脚本和在命令行下进行操作都是非常重要的。
希望这些信息能够帮助你更好地理解Shell的基础语法。
Shell脚本中的调试技巧和工具Shell脚本是一种用于自动化任务和批处理的脚本语言,广泛应用于Linux和Unix操作系统中。
为了确保脚本的正确性和稳定性,调试是非常重要的一环。
本文将介绍一些常用的Shell脚本调试技巧和工具,帮助开发者快速定位和解决问题。
一、使用echo语句输出调试信息在编写Shell脚本时,我们可以使用echo语句输出调试信息。
通过打印变量的值或者各个执行步骤的提示信息,可以帮助我们理解脚本的执行过程。
例如,我们可以使用以下语句在脚本某一关键点输出变量的值:```echo "变量x的值为:$x"```通过查看输出结果,我们可以确定变量x当前的取值是否正确,从而判断脚本的逻辑是否正确。
二、使用set -x命令启用调试模式在Shell脚本中,我们可以使用set -x命令来启用调试模式。
调试模式会输出每条命令的执行结果,帮助我们了解脚本的执行过程。
例如,我们可以在脚本的第一行添加以下语句:```set -x```这样,在执行脚本时,系统会输出每一条命令的执行结果,包括命令的具体语法和参数值。
通过查看这些输出,我们可以了解到脚本在某个位置发生了错误或逻辑问题。
需要注意的是,在调试完成后,一定要记得将set -x命令删除或注释掉,以避免调试信息泄露给不必要的人员。
三、使用set -e命令检测错误Shell脚本中的命令有时可能会执行失败,为了及时发现并处理这些错误,我们可以在脚本中使用set -e命令。
该命令会在遇到执行失败的命令时,立即退出脚本的执行。
例如,我们可以在脚本的第一行添加以下语句:```set -e```这样,在执行脚本时,如果某个命令执行失败,脚本会立即停止执行,并输出错误信息。
通过查看这些错误信息,我们可以快速定位问题所在,并进行相应的处理。
四、使用trap命令捕捉信号在Shell脚本中,我们可以使用trap命令捕捉信号。
当脚本接收到指定的信号时,可以执行指定的命令或函数。
Shell脚本编写的高级技巧使用命令补全简化操作Shell脚本是一种在Unix/Linux系统中广泛使用的脚本语言,它提供了执行系统命令和编写自动化任务的丰富功能。
在Shell脚本编写过程中,掌握一些高级技巧可以使代码更加简洁高效。
本文将介绍如何使用命令补全来简化Shell脚本的操作。
一、命令补全介绍命令补全是Shell脚本中一个非常实用的功能,它可以根据用户的输入来自动补全命令、文件名、路径等内容,大大提高了命令输入的效率。
在Shell中,Tab键是默认的命令补全快捷键,当用户输入部分命令或路径后按下Tab键,系统会自动补全剩余内容或列出可能的补全选项。
二、命令补全的基本用法在Shell脚本编写中,命令补全可以大大减少手动输入的工作量。
以下是几种常见的命令补全用法:1. 命令补全命令Shell脚本中可以使用`compgen`命令来获取命令补全的结果。
`compgen`命令可以根据用户输入的前缀来生成匹配的命令或文件名列表。
例如,以下命令可以列出以"ls"开头的命令:```compgen -c ls```2. 自动补全文件名在Shell脚本中,可以使用`*`通配符来自动补全文件名。
例如,以下命令会列出当前目录下所有以sh结尾的文件:```ls *.sh```3. 命令参数补全命令补全还可以用于参数的自动补全。
当输入命令时,按下Tab键可以列出该命令可能的参数选项。
例如,输入`ls -`后按下Tab键会列出可能的参数选项,如`ls -a`、`ls -l`等。
三、使用命令补全优化Shell脚本编写在编写Shell脚本时,可以充分利用命令补全的功能来简化操作。
以下是几个使用命令补全优化Shell脚本的实例:1. 快速切换目录在Shell脚本中,经常需要切换工作目录。
可以使用命令补全来快速切换目录。
例如,输入`cd /u/s/b`后按下Tab键,系统会自动补全为`cd /usr/share/bash-completion`。
Shell脚本编写的高级技巧如何处理大量数据和大文件的高级方法Shell脚本是一种强大的自动化工具,能够帮助我们处理各种任务。
当涉及到大量数据和大文件时,我们需要一些高级技巧来有效地处理和管理这些资源。
本文将介绍几种Shell脚本编写的高级技巧,帮助您处理大量数据和大文件。
一、并行处理数据在处理大量数据时,串行处理可能会非常缓慢。
为了提高处理效率,我们可以使用并行处理来同时处理多个数据。
在Shell脚本中,我们可以使用“&”符号来表示任务在后台运行,并同时启动多个任务。
例如,我们有一个包含100个文件的目录,我们可以使用以下脚本来并行处理这些文件:```shellfor file in /path/to/directory/*; doprocess_file $file &donewait```此脚本将会同时启动多个process_file函数,每个函数处理一个文件。
在启动完所有任务后,使用wait命令等待所有任务完成。
二、分割大文件当我们需要处理大文件时,一次读取整个文件可能会导致内存溢出。
为了避免这种情况,我们可以将大文件分割成更小的块,然后逐个处理每个块。
以下是一个示例脚本,用于将大文件拆分成多个小文件:```shellsplit -l 1000 /path/to/large_file /path/to/output/files/segment_```此脚本将大文件拆分成以“segment_”为前缀的小文件,每个文件包含1000行数据。
拆分大文件可以让我们更有效地处理和分析数据。
三、增加缓冲区大小当处理大文件时,默认的缓冲区大小可能会导致性能下降。
我们可以通过设置更大的缓冲区大小来提高处理速度。
以下是一个示例脚本,用于增加缓冲区大小:```shellexport LC_ALL=Cexport GREP_OPTIONS='--buffer-size=4M'grep "pattern" /path/to/large_file```此脚本使用grep命令来查找包含指定模式的行。
shell脚本介绍以及常⽤命令Shell脚本Shell Script,Shell与Windows/Dos下的相似,也就是⽤各类命令预先放⼊到⼀个⽂件中,⽅便⼀次性执⾏的⼀个,主要是⽅便进⾏设置或者管理⽤的。
但是它⽐Windows下的批处理更强⼤,⽐⽤其他编程的程序效率更⾼,毕竟它使⽤了Linux/Unix下的命令。
换⼀种说法也就是,shell script是利⽤shell的功能所写的⼀个程序,这个程序是使⽤,将⼀些shell的语法与指令写在⾥⾯,然后⽤正规表⽰法,管线命令以及数据流重导向等功能,以达到我们所想要的处理⽬的shell和shell脚本的区别:shell是什么呢?确切⼀点说,Shell就是⼀个,它的作⽤就是遵循⼀定的语法将输⼊的命令加以解释并传给系统。
它为⽤户提供了⼀个向Linux发送请求以便运⾏程序的接⼝系统级程序,⽤户可以⽤Shell来启动、挂起、停⽌甚3⾄是编写⼀些程序。
Shell本⾝是⼀个⽤C语⾔编写的程序,它是⽤户使⽤Linux的桥梁。
Shell既是⼀种命令语⾔,⼜是⼀种(就是你所说的shell脚本)。
作为命令语⾔,它互动式地解释和执⾏⽤户输⼊的命令;作为程序设计语⾔,它定义了各种和参数,并提供了许多在⾼阶语⾔中才具有的控制结构,包括循环和分⽀。
它虽然不是 Linux系统的⼀部分,但它调⽤了系统内核的⼤部分功能来执⾏程序、创建⽂档并以并⾏的⽅式协调各个程序的运⾏。
交互式shell和⾮交互式shell 交互式模式就是shell等待你的输⼊,并且执⾏你提交的命令。
这种模式被称作交互式是因为shell与⽤户进⾏交互。
这种模式也是⼤多数⽤户⾮常熟悉的:登录、执⾏⼀些命令、签退。
当你签退后,shell也终⽌了。
shell也可以运⾏在另外⼀种模式:⾮交互式模式。
在这种模式下,shell不与你进⾏交互,⽽是读取存放在⽂件中的命令,并且执⾏它们。
当它读到⽂件的结尾,shell也就终⽌了。
shell 调用方法Shell调用方法是指在Shell脚本中调用其他命令或脚本的方式。
在Shell中,可以使用不同的方式来调用其他命令或脚本,比如使用函数、source 命令、alias 命令等。
1. 使用函数调用在 Shell 中定义一个函数,然后在脚本中调用该函数,可以实现调用其他命令或脚本的功能。
函数的定义方式如下:```shellfunction function_name {command}```其中,function_name 是函数名,command 是执行的命令或脚本。
在脚本中调用该函数的方式如下:```shellfunction_name```2. 使用 source 命令调用使用 source 命令可以在当前 Shell 环境中执行指定的脚本文件。
该命令的格式如下:```shellsource filename```其中,filename 是要执行的脚本文件名。
使用该命令可以将指定的脚本文件中的命令或函数引入到当前 Shell 环境中,从而实现调用其他命令或脚本的功能。
3. 使用 alias 命令调用使用 alias 命令可以在 Shell 中定义一个命令别名,从而可以通过执行该别名来调用其他命令或脚本。
该命令的格式如下:```shellalias alias_name='command'```其中,alias_name 是要定义的命令别名,command 是要执行的命令或脚本。
使用该命令可以将指定的命令或脚本定义为一个别名,从而实现调用其他命令或脚本的功能。
以上是 Shell 调用方法的简要介绍,通过不同的方式调用其他命令或脚本可以实现不同的功能。
因此,根据实际需求选择最适合的调用方法是非常重要的。
GENERAL TERMS AND CONDITIONSFOR CFR/CIF/DELIVERED EX SHIP SALES OF CRUDE OIL TOTAL-CRUDE-CFR/CIF/DES2007 edition1CONTENTSSECTION TITLE PAGEI DEFINITIONS 2 II DELIVERY TERMS AND PASSING OF RISK AND PROPERTY 3 III QUALITY 4 IV INVOICING AND PAYMENT 4 V DESTINATION 6 VI VESSEL 7 VII ARRIVAL AND DISCHARGE OF VESSEL AT THE DISCHARGE TERMINAL 10 VIII LAYTIME AND DEMURRAGE11 IX QUANTITY AND QUALITY DETERMINATION 12 X DOCUMENTS 14 XI GOVERNMENT TAKE, NEW OR CHANGED REGULATIONS 15 XII EXCEPTIONS - FORCE MAJEURE16 XIII TERMINATION 17 XIV ASSIGNMENT 19 XV WAIVER 19 XVI NOTICES 19 XVII HEALTH, SAFETY AND ENVIRONMENTAL INFORMATION 20 XVIII APPLICABLE LAW AND JURISDICTION 20 XIX GENERAL 20 APPENDIX 1LETTER OF INDEMNITY 22APPENDIX 2OFFSHORE LOADED CRUDE OIL 23-o-o-o-O-o-o-o-2These General Terms and Conditions may be referred to as TOTAL-CRUDE-CFR/CIF/DES.SECTION I - DEFINITIONSIn the Agreement (as hereinafter defined), the following terms shall have, unless the context otherwise requires, the following meanings:- Affiliate: Any company or other legal entity directly or indirectly controlling or controlled bya party to the Agreement or controlled directly or indirectly by any company orother legal entity having direct or indirect control over that party.- AFRA: The Average Freight Rate Assessment as published by the London TankerBrokers' Panel Limited; the applicable rate shall be the rate published at thebeginning of the month in which the Vessel loads, irrespective of the referenceperiod mentioned in the publication.- Agreement: The Special Terms and Conditions and the General Terms and Conditions togetherand any agreed amendment(s) thereto, the Special Terms and Conditions being thatpart of the Agreement other than the General Terms and Conditions, comprising theoral and written communications evidencing an agreement between Seller andBuyer to a CFR or CIF or CFR Outturn or CIF Outturn or DELIVERED EX SHIPcontract of sale and the General Terms and Conditions being these General Termsand Conditions for CFR/CIF/DELIVERED EX SHIP Sales of Crude Oil, referenceTOTAL-CRUDE-CFR/CIF/DES, as supplemented and amended, for deliveries of Oilloaded from offshore loading facilities, by the provisions set out in Appendix 2.- Barrel: US Barrel of FORTY-TWO (42) United States standard gallons.- CFR and CIF: As ascribed thereto in Incoterms 2000 (as amended from time to time), except asmodified by the Agreement. If there is any inconsistency or conflict between saidIncoterms and the Agreement, the Agreement shall prevail.- CFR Outturn andCIF Outturn : As ascribed to CFR and CIF respectively in this Section I, subject to the invoicingadjustment set out in sub-section IX.2(c).- Discharge Terminal: The port or ports of discharge and/or the receiving facilities at which the Oil isdischarged or is to be discharged.- Ex Ship (DES) : As ascribed to DES in Incoterms 2000 (as amended from time to time), except asmodified by the Agreement. If there is any inconsistency or conflict between saidIncoterms and the Agreement, the Agreement shall prevail.- FPA : Free of Particular Average.- ICS : The International Chamber of Shipping.- Loading Date(s) : The day (or range of days) when the vessel is expected to load (as specified in theSpecial Terms and Conditions) or, if known, the bill of lading date.- Loading Terminal: The loading port or ports and/or the loading facilities at which the Oil is loaded oris to be loaded.- Loading TerminalOperator : Any legal entity which at the time of loading is the operator of the loading facilitiesat which the Oil is loaded or is to be loaded.3- L.O.I.: Letter of Indemnity.- N.O.R.: Notice of Readiness.- OCIMF: The Oil Companies International Marine Forum.- Oil: Such crude oil(s), and/or condensate as more particularly described in the SpecialTerms and Conditions and sold or nominated to be sold under the Agreement.- Seller's Supplier: Any legal entity supplying or expected by Seller to supply to Seller directly orindirectly the Oil or services necessary to deliver the Oil to Buyer.- Shipment: Any specific quantity of Oil delivered or to be delivered under the Agreement asone full or part cargo lot.- SOLAS: The International Convention for the Safety of Life at Sea 1974 (as amended).- Ton: Metric ton or tonne. ONE THOUSAND (1,000) kilograms.- Vessel : A tankship or other vessel which is adapted for the carriage of Oil.- Working Day : A day other than a Saturday or Sunday or a bank holiday in London.- Worldscale : The New Worldwide Tanker Nominal Freight Scale as current on the day ofcommencement of loading the Vessel in question at the Loading Terminal. SECTION II - DELIVERY TERMS AND PASSING OF RISK AND PROPERTYII.1 In the case of CFR and CIF deliveries (including CFR Outturn and CIF Outturn deliveries): The Oil shall be delivered by Seller to Buyer in bulk at the Loading Terminal and shipped by Seller CFR or CIF (as applicable) to the agreed destination.Notwithstanding any right of Seller to retain the shipping documents until payment, risk and property in the Oil and all liabilities with respect thereto shall pass to Buyer when the Oil passes the flange connection between the delivery hose and the permanent hose connection of the Vessel at the Loading Terminal.If the Oil is sold or nominated to be sold afloat, then risk in the Oil and all liabilities with respect thereto shall pass to Buyer as from the time the Oil passes the flange connection between the delivery hose and the permanent hose connection of the Vessel at the Loading Terminal, and property in the Oil shall pass to Buyer upon acceptance of the nomination of the Vessel by Buyer.II.2 In the case of Ex Ship deliveries:The Oil shall be delivered by Seller to Buyer in bulk DES at the Discharge Terminal.Risk and property in the Oil and all liabilities with respect thereto shall pass to Buyer when the Oil passes the permanent discharge manifold of the Vessel and the receiving hose at the Discharge Terminal.Without limiting any other provision of this Agreement, any loss of, or damage to, the Oil occurring before, during or after the discharge operations, which is caused by Buyer or the receiver of the Oil or any of their respective contractors, agents or employees, or by the Discharge Terminal, shall be for the account of Buyer.4II.3Buyer shall be the importer of record into the country in which the Discharge Terminal is situated and shall comply with all applicable laws and regulations governing said importation.II.4Notwithstanding anything elsewhere in the Agreement to the contrary, if Buyer fails to take delivery (in whole or in part) of any Shipment, such Shipment shall, at Seller's option, cease to be deliverable to Buyer under the Agreement and, in such event, such Shipment shall be deducted from the total quantity of Oil to be delivered under the Agreement, without prejudice to any other rights or remedies which Seller may have against Buyer. In such case, Seller shall dispose freely of, and may sell or otherwise dispose of, such Shipment at its sole and absolute discretion. The provisions of this sub-section II.4 shall apply whether Buyer is to receive one, or more than one, Shipment hereunder.II.5If, under the Agreement, Buyer is to receive more than one Shipment, then, unless otherwise provided for in the Agreement:(a) each Shipment shall constitute a separate contract; and(b) such Shipments shall be evenly spread.SECTION III - QUALITYTHERE ARE NO REPRESENTATIONS, DUTIES (WHETHER IN NEGLIGENCE OR OTHERWISE), CONDITIONS, GUARANTEES, WARRANTIES OR TERMS, EXPRESS OR IMPLIED, WHETHER IMPLIED BY STATUTE OR OTHERWISE, AS TO THE DESCRIPTION OR SATISFACTORY QUALITY, FITNESS OR SUITABILITY OF THE OIL FOR ANY PURPOSE WHATSOEVER, OR OTHERWISE RELATING TO THE QUALITY OF THE OIL, WHICH EXTEND BEYOND THE DESCRIPTION OF THE OIL APPEARING IN THE AGREEMENT.SECTION IV - INVOICING AND PAYMENTIV.1The price of the Oil and the due date for payment shall be as specified in the Special Terms and Conditions.Payment of the full amount of Seller’s invoice shall be made without any discount, deduction, withholding, abatement, set-off or counterclaim in United States Dollars (unless otherwise specified in the Special Terms and Conditions) by wire transfer of immediately available funds ("same day funds") on or before the due date (subject to sub-sections IV.3 and IV.6) to the bank and account designated by Seller, against presentation to Buyer by means of courier, facsimile transmission and/or electronic messaging system, of an invoice and either the original bills of lading and other contractual documents or a letter of indemnity, as provided for in Section X.IV.2 Unless otherwise agreed, the payment of any other costs, expenses or charges which arise under the terms of the Agreement shall be made against presentation of Seller's invoice and shall be for immediate settlement by Buyer on or by the date advised thereon.Buyer's obligation to pay shall survive the term of the Agreement and shall not be deemed fulfilled for so long as the price of the Oil and any other costs, expenses and charges have not been credited in full into Seller's bank account.IV.3When the due date falls on a Saturday or on a weekday, other than a Monday, which is not a banking day in New York or at such other place as may be designated by Seller for payment, then any such payment shall be made on the nearest preceding banking day. When the due date falls on a Sunday ora Monday which is not a banking day in New York or at such other place so designated, then any suchpayment shall be made on the next following banking day.5IV.4Any delay in effecting any payment by the due date shall entitle Seller to receive payment of interest for each day of delay, calculated as per the USD rate for ONE (1) month of BRITISH BANKERS’ ASSOCIATION LIBOR RATES (“BBALR”) as published on the due date (subject to sub-section IV.3) on Reuters page ''LIBORO1'' and/or on /public/libor (or successor thereto), plus TWO(2) percentage points per annum, such interest being in no circumstances to be construed as anagreement by Seller to provide extended credit, and is in addition to any other rights of Seller arising out of such delay.In addition to any other rights of Seller, all expenses incurred by Seller, including but not limited to, reasonable legal fees, court costs and collection agency fees, caused by delayed payment or non-payment by Buyer of the full amount of Seller’s invoice for each Shipment shall be for the account of Buyer and payable upon demand with supporting documentation.IV.5Where the pricing information available to Seller does not allow for the preparation of a final invoice, Seller may issue a provisional invoice, against which Buyer shall make payment. The provisional price shall, unless otherwise agreed between the parties, be based upon the pricing information available to Seller at the time it issues such provisional invoice. Payment of any balance due by either party shall be made immediately upon receipt of Seller’s final invoice, which shall be prepared as soon as practicable after all the relevant information becomes available to Seller.IV.6 If payment by means of provision of an irrevocable documentary letter of credit is not already provided for in the Special Terms and Conditions, Seller shall be entitled at any time before the due date to demand payment to be effected by means of provision of an irrevocable letter of credit or by payment in advance notwithstanding the method of payment as described in the Special Terms and Conditions.Nothing in this sub-section IV.6 shall relieve Buyer of its obligation to pay the total price of each Shipment as and when due under the Agreement.IV.7When, under the Agreement, or as a consequence of the provisions of sub-section IV.6, payment is to be made by means of an irrevocable letter of credit (referred to herein as ''L/C''), the following provisions shall apply unless otherwise specified in the Special Terms and Conditions:(a) the L/C shall be issued or confirmed by a bank and in a format both of which must be acceptableto Seller, not later than TEN (10) calendar days prior to the Loading Date (or the first day of theLoading Dates), or on such other date and at such time as Seller may in writing require;(b) all fees, commissions, costs and expenses incurred with respect to such payment or L/C shall beborne by Buyer;(c)the L/C shall cover the mean value of the Shipment at the contract price (including, if applicable,any Value Added Tax and/or excise duty) plus TEN (10) per cent and shall at all times be valid:(i) in the case of CFR/CIF deliveries, for shipment THREE (3) days before and SEVEN (7) daysafter the Loading Date(s);(ii) in the case of DES deliveries, for delivery THREE (3) days before and SEVEN (7) days after the contractual delivery range or, in the absence of such contractual range, THREE (3) daysbefore and SEVEN (7) days after the estimated date of completion of discharge in respect ofthe Vessel;(d)if for any reason the loading or discharge, as the case may be, of the Vessel will not take placewithin the period for such loading or discharge referred to in the L/C, Buyer shall either obtain anextension of such period or provide a new L/C in terms acceptable to Seller;(e)no term of the L/C (nor any agreed amendment thereto) shall amend, alter, add to, or in any wayaffect the terms of the Agreement (or any of them) unless Seller and Buyer expressly agree inwriting to amend the Agreement accordingly.6IV.8It is a condition of the Agreement that Buyer complies with its payment obligations under the Agreement (including any obligation to provide security or a payment undertaking in the form specified by Seller as well as any and all obligations under this Section IV) within the time prescribed by Seller and/or by the Agreement. Any failure either in whole or in part by Buyer to comply with any such obligation shall be a breach of condition.On the occurrence of such breach and for so long as such breach is continuing:(a) if the Oil has been delivered to Buyer on board the Vessel, then, at Seller’s option exercisable atany time by written notice of Seller to Buyer, title, but not risk, in the Oil shall revert to and/orremain with Seller; and(b) in all cases, Seller may at any time by notice to Buyer, without prejudice to any other legalremedies Seller may have and without any liability whatsoever for any cost, loss or damage(including liabilities to third parties) incurred by Buyer, forthwith:(i) cancel delivery of all or any Shipments; or(ii) without prejudice to any other rights of Seller, withhold delivery of Oil under the Agreement and/or release of shipping documents or letter of indemnity.Seller may exercise the rights set out above whether or not nominations have been made or accepted and, if Seller exercises any such right, Seller shall be entitled to dispose freely of any resulting quantity of Oil and Buyer shall be liable for, and indemnify Seller and/or Seller's Supplier for, any costs, losses and damages incurred by Seller and/or Seller's Supplier as a result of Buyer's breach.SECTION V - DESTINATIONV.1 Buyer undertakes, and it is a condition of the Agreement, that the Oil shall not:(a)be shipped directly or indirectly through; or(b)be disposed of, directly or indirectly and irrespective of means, by way of resale, exchange, loanor other arrangement for the supply of the Oil to any buyer and/or receiver in,any country which is subject to a prohibition by the governmental authorities of the country in which the Oil has been produced or loaded.If Buyer is, or is likely to be, prevented by any law, policy, demand or request to which Buyer is subject or any governmental policy, demand or request by which Buyer is bound, from complying with the above, Seller and Buyer shall meet and discuss the implications for Buyer and Seller and, pending resolution of any difficulty which such event causes or is likely to cause, Seller may at its discretion suspend in whole or in part supplies hereunder.At any time, Seller may require Buyer to provide any relevant documents for the purpose of verifying the final destination of the Oil, and Buyer undertakes to provide such documents upon request.V.2 Buyer undertakes that the Oil deliverable hereunder shall not:(a) be exported to any Restricted Jurisdiction (as defined below); or(b) be sold or supplied to any natural or legal person in any Restricted Jurisdiction; or(c) be sold or supplied to any natural or legal person or entity for the purpose of any commercialactivity carried out in or from any such Restricted Jurisdiction.For the purposes of this sub-section V.2, "Restricted Jurisdiction" shall mean any country, state, territory or region against which there are sanctions imposed by the United Nations or any other7V.3 Should Buyer be in breach of any provisions of this Section V, Seller may at any time thereafter immediately terminate the Agreement, without being liable for any indemnity to Buyer.Moreover, Buyer agrees to hold Seller harmless from, and indemnify Seller for, any losses, costs, damages, fines and/or penalties incurred by Seller resulting from any such breach.SECTION VI - VESSELVI.1Contract of Carriage and Insurance(a) In the case of CFR, CIF, CFR Outturn or CIF Outturn deliveries:Seller shall provide carriage of the Oil under bills of lading, which may incorporate charter partyconditions.(b) In the case of CFR or CFR Outturn deliveries:The responsibility for securing cargo insurance on any Shipment, whether against marine, war orother risks, and the costs resulting therefrom shall rest wholly with Buyer.(c) In the case of CIF or CIF Outturn deliveries:Seller shall procure and pay for cargo insurance against marine risks for ONE HUNDRED ANDTEN (110) per cent of the CIF value of the cargo. Such insurance shall: (i) operate from shore tankat the Loading Terminal to shore tank at the Discharge Terminal; (ii) be contracted with aninsurance company of good repute; (iii) be in accordance with the minimum cover of the InstituteCargo Clauses (Institute of London Underwriters); (iv) be on an ''FPA'' basis; and (v) include warrisk coverage.(d) For all deliveries (CFR, CIF, CFR Outturn, CIF Outturn, Ex Ship):(i) Any and all costs in respect of war risk insurance for the Vessel's hull and machinery or forcargo or both in respect of the voyages to any of the ports of loading or discharge or anyseas through which the Vessel has to travel in the performance of the Agreement, in excessof those prevailing at the date the Agreement is entered into, including any additionalinsurance or war risk insurance premium, as well as crew war bonuses or any other bonusesrelating to the Shipment, shall be solely for the account of Buyer.(ii) Seller reserves the right to refuse at any time:1. to direct any Vessel to undertake or to complete the voyage to the Loading Terminalor Discharge Terminal if such Vessel is required in the performance of theAgreement:1.1 to transit or to proceed to or to remain in waters so that the vessel concernedwould be involved in a breach of any Institute Warranties (if applicable) or, inSeller's opinion, to risk its safety; or1.2 to transit or to proceed or to remain in waters where there is war (de facto or dejure) or threat thereof; or2. prior to the commencement of loading, to direct any Vessel to undertake the voyageto the intended Loading Terminal or Discharge Terminal if such Vessel is required inthe performance of the terms of the Agreement to transit in waters which, in Seller'sreasonably held opinion, would involve abnormal delay; or3. to undertake any activity in furtherance of the voyage which in the opinion of theVessel's master could place the Vessel, its cargo or crew at risk.8(iii) If Seller agrees to direct a Vessel to undertake or to complete a voyage as referred to in paragraph (ii) of this sub-section VI.1(d), Buyer undertakes to reimburse Seller, in addition toother amounts payable under the Agreement, for costs incurred by Seller in respect of anyadditional insurance premium (including those referred to in paragraph (i) of this sub-sectionVI.1(d)) and any other sums that Seller may be required to pay to the Vessel's owner,including but not limited to, any sums in respect of any amounts deductible under suchowner's insurance and any other costs and/or expenses incurred by Seller.VI.2Nomination of VesselUnless otherwise specified in the Special Terms and Conditions, Seller shall notify Buyer in writing as far in advance as practically possible of the Vessel’s name and the pertinent characteristics of the Vessel, the quantity and grade of the Oil to be delivered and, for CFR or CIF deliveries, the Loading Date(s) and Loading Terminal. Seller may mention “TBN” in place of the Vessel's name; in such a case, unless otherwise agreed, the Vessel's name and pertinent characteristics and the information described in this sub-section VI.2 shall be given by Seller to Buyer as soon as practicable.VI.3Substitution of VesselSeller may, at any time prior to discharge, substitute for a Vessel previously nominated another Vessel whose size, capacity, loading quantity and, if the price of the Oil is determined by the bill of lading date, the bill of lading date itself, are equivalent to those of the Vessel originally nominated.VI.4Acceptance of VesselUnless otherwise specified in the Special Terms and Conditions, Buyer shall notify Seller in writing within TWENTY-FOUR (24) hours of any Vessel’s nomination whether Buyer accepts or refuses such nomination; Buyer’s acceptance not to be unreasonably withheld.VI.5Nomination of Discharge TerminalUnless otherwise specified in the Special Terms and Conditions, Buyer shall within TWENTY-FOUR(24) hours after receipt of Seller's Vessel nomination notify Seller in writing of the Discharge Terminaland (in the case of CFR or CIF deliveries) full documentary instructions, including any instructions needed by Seller to issue documents in accordance with the regulations in force at the Loading Terminal (including, but not limited to, any export regulations). Any delay or costs (including, but not limited to, any demurrage incurred in respect of the Seller’s Vessel and any demurrage incurred by Seller or Seller's Supplier in respect of other Vessels waiting at the Loading Terminal) arising out of any failure by Buyer to comply with the foregoing shall be for Buyer's account. Seller shall have the right to issue its own instructions if such instructions are not so provided by Buyer. No change to the Discharge Terminal shall be made without Seller's prior consent.Where under the Special Terms and Conditions Buyer has discharge port options, Buyer shall exercise any such discharge port options in accordance with the Special Terms and Conditions and the terms of the relevant charter party available to Seller. Whenever Buyer exercises such options, the price stated in the Special Terms and Conditions shall be adjusted by the freight differential calculated in accordance with the terms of such charter party or as otherwise agreed between the parties. Buyer shall be liable for any additional costs incurred by Seller, including but not limited to, any deviation costs and costs in respect of any additional bunker consumption.In exercising its discharge port options, Buyer must take account of the dimensions and characteristics of the Vessel nominated by Seller.VI.6Part CargoesThe discharge of part cargoes of Oil shall be deemed to be accepted by Buyer.9VI.7Requirements in respect of Vessel and Discharge Terminal(a) For each Vessel specified in, or nominated under, the Agreement:(i) Seller warrants that the Vessel is owned or demise chartered (throughout the entire period ofthe voyage to the Discharge Terminal) by a member of the International Tanker OwnersPollution Federation Limited (ITOPF).(ii) Seller shall exercise reasonable efforts to ensure that:1. the Vessel carries on board a valid certificate of insurance as described in theInternational Convention on Civil Liability for Oil Pollution Damage (CLC), 1969 or, if inforce, the 1992 Protocol thereto, as amended;2. the Vessel is entered in and shall remain throughout the entire period of the voyage tothe Discharge Terminal and up to discharge of the Oil, in a P and I Club which is amember of the International Group of P and I Clubs;3. the Vessel has in place (throughout the entire period of the voyage to the DischargeTerminal and up to discharge of the Oil) insurance cover for oil pollution in an amountof no less than the highest standard oil pollution cover available under the rules of theInternational Group of P and I Clubs; and4. the Vessel shall comply with the requirements of the International Safety Management(“ISM”) Code and has on board a valid ISM Code Safety Management Certificate forthe Vessel and a copy of the Vessel Manager's Document of Compliance as requiredby the ISM Code and SOLAS.(iii) Seller shall procure that:1. the Vessel shall comply with the requirements of the International Code for theSecurity of Ships and of Port Facilities and the relevant amendments to chapter XI ofSOLAS (“ISPS Code”) and, if the Discharge Terminal is located within the USA andUS territories, with the US Maritime Transportation Security Act 2002 (“MTSA”) andshall have on board a valid International Ship Security Certificate as well as any otherrequired valid certificates and documents, issued pursuant to the ISPS Code as well as,if applicable, the MTSA; and2. the Vessel shall when required submit a Declaration of Security to the appropriateauthorities prior to arrival at the Discharge Terminal.(b)Notwithstanding any prior acceptance of the Vessel by Buyer, if at any time the Vessel fails tocomply with any of the requirements set out in sub-section VI.7(a) above, then: (i) Buyer may atany time refuse to berth or discharge or continue to discharge the Vessel and all time lost or spentas a result thereof shall not count as used laytime, or if the Ve ssel is on demurrage, as demurrage,and (ii) Seller shall be obliged to substitute the Vessel with a Vessel whose size and capacity areequivalent to those of the Vessel originally nominated and complying with such requirements.(c)Buyer shall procure that the Discharge Terminal shall comply with the requirements of the ISPSCode and, if the Discharge Terminal is located within the USA and US territories, with the MTSA.Any costs or expenses in respect of the Vessel, including demurrage or any additional charge, feeor duty levied on the Vessel at the Discharge Terminal and actually incurred by Seller resultingdirectly from the failure of the Discharge Terminal to comply with the ISPS Code or, if theDischarge Terminal is located within the USA and US territories, with the MTSA, shall be for theaccount of Buyer, including, but not limited to, the time required or costs incurred by the Vesselin taking any action or any special or additional security measures required by the ISPS Code and,if applicable, the MTSA.。