往往是因为网络传输的限制,导致很多时候,我们需要在 Linux 系统下进行大文件的切割。这样将一个大文件切割成为多个小文件,进行传输,传输完毕之后进行合并即可。
推荐学习:《linux视频教程》
文件切割 - split
在 Linux 系统下使用 split 命令进行大文件切割很方便
命令语法
-a: #指定输出文件名的后缀长度(默认为2个:aa,ab...)
-d: #指定输出文件名的后缀用数字代替
-l: #行数分割模式(指定每多少行切成一个小文件;默认行数是1000行)
-b: #二进制分割模式(支持单位:k/m)
-C: #文件大小分割模式(切割时尽量维持每行的完整性)
split [-a] [-d] [-l <行数>] [-b <字节>] [-C <字节>] [要切割的文件] [输出文件名]
使用实例
# 行切割文件 $ split -l 300000 users.sql /data/users_ # 使用数字后缀 $ split -d -l 300000 users.sql /data/users_ # 按字节大小分割 $ split -d -b 100m users.sql /data/users_
帮助信息
# 帮助信息 $ split --help Usage: split [OPTION]... [FILE [PREFIX]] Output pieces of FILE to PREFIXaa, PREFIXab, ...; default size is 1000 lines, and default PREFIX is 'x'. With no FILE, or when FILE is -, read standard input. Mandatory arguments to long options are mandatory for short options too. -a, --suffix-length=N generate suffixes of length N (default 2) 后缀名称的长度(默认为2) --additional-suffix=SUFFIX append an additional SUFFIX to file names -b, --bytes=SIZE put SIZE bytes per output file 每个输出文件的字节大小 -C, --line-bytes=SIZE put at most SIZE bytes of records per output file 每个输出文件的最大字节大小 -d use numeric suffixes starting at 0, not alphabetic 使用数字后缀代替字母后缀 --numeric-suffixes[=FROM] same as -d, but allow setting the start value -e, --elide-empty-files do not generate empty output files with '-n' 不产生空的输出文件 --filter=COMMAND write to shell COMMAND; file name is $FILE 写入到shell命令行 -l, --lines=NUMBER put NUMBER lines/records per output file 设定每个输出文件的行数 -n, --number=CHUNKS generate CHUNKS output files; see explanation below 产生chunks文件 -t, --separator=SEP use SEP instead of newline as the record separator; 使用新字符分割 '\0' (zero) specifies the NUL character -u, --unbuffered immediately copy input to output with '-n r/...' 无需缓存 --verbose print a diagnostic just before each 显示分割进度 output file is opened --help display this help and exit 显示帮助信息 --version output version information and exit 显示版本信息 The SIZE argument is an integer and optional unit (example: 10K is 10*1024). Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000). CHUNKS may be: N split into N files based on size of input K/N output Kth of N to stdout l/N split into N files without splitting lines/records l/K/N output Kth of N to stdout without splitting lines/records r/N like 'l' but use round robin distribution r/K/N likewise but only output Kth of N to stdout GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Full documentation at: <http://www.gnu.org/software/coreutils/split> or available locally via: info '(coreutils) split invocation'
文件合并 - cat
在 Linux 系统下使用 cat 命令进行多个小文件的合并也很方便
命令语法
-n: #显示行号
-e: #以$字符作为每行的结尾
-t: #显示TAB字符(^I)
cat [-n] [-e] [-t] [输出文件名]
使用实例
# 合并文件 $ cat /data/users_* > users.sql
帮助信息
# 帮助信息 $ cat --h Usage: cat [OPTION]... [FILE]... Concatenate FILE(s) to standard output. With no FILE, or when FILE is -, read standard input. -A, --show-all equivalent to -vET -b, --number-nonblank number nonempty output lines, overrides -n -e equivalent to -vE -E, --show-ends display $ at end of each line -n, --number number all output lines -s, --squeeze-blank suppress repeated empty output lines -t equivalent to -vT -T, --show-tabs display TAB characters as ^I -u (ignored) -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB --help display this help and exit --version output version information and exit Examples: cat f - g Output f's contents, then standard input, then g's contents. cat Copy standard input to standard output. GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Full documentation at: <http://www.gnu.org/software/coreutils/cat> or available locally via: info '(coreutils)
以上是在Linux系统下进行大文件的切割和合并的详细内容。更多信息请关注PHP中文网其他相关文章!

Linux操作系统的5个核心组件是:1.内核,2.系统库,3.系统工具,4.系统服务,5.文件系统。这些组件协同工作,确保系统的稳定和高效运行,共同构成了一个强大而灵活的操作系统。

Linux的五个核心元素是:1.内核,2.命令行界面,3.文件系统,4.包管理,5.社区与开源。这些元素共同定义了Linux的本质和功能。

Linux用户管理和安全性可以通过以下步骤实现:1.创建用户和组,使用命令如sudouseradd-m-gdevelopers-s/bin/bashjohn。2.批量创建用户和设置密码策略,使用for循环和chpasswd命令。3.检查和修复常见错误,如家目录和shell设置。4.实施最佳实践,如强密码策略、定期审计和最小权限原则。5.优化性能,使用sudo和调整PAM模块配置。通过这些方法,可以有效管理用户和提升系统安全性。

Linux文件系统和进程管理的核心操作包括文件系统的管理和进程的控制。1)文件系统操作包括创建、删除、复制和移动文件或目录,使用命令如mkdir、rmdir、cp和mv。2)进程管理涉及启动、监控和终止进程,使用命令如./my_script.sh&、top和kill。

Shell脚本是Linux系统中用于自动化执行命令的强大工具。1)Shell脚本通过解释器逐行执行命令,处理变量替换和条件判断。2)基本用法包括备份操作,如使用tar命令备份目录。3)高级用法涉及使用函数和case语句管理服务。4)调试技巧包括使用set-x开启调试模式和set-e在命令失败时退出。5)性能优化建议避免子Shell,使用数组和优化循环。

Linux是一个基于Unix的多用户、多任务操作系统,强调简单性、模块化和开放性。其核心功能包括:文件系统:以树状结构组织,支持多种文件系统如ext4、XFS、Btrfs,使用df-T查看文件系统类型。进程管理:通过ps命令查看进程,使用PID管理进程,涉及优先级设置和信号处理。网络配置:灵活设置IP地址和管理网络服务,使用sudoipaddradd配置IP。这些功能在实际操作中通过基本命令和高级脚本自动化得以应用,提升效率并减少错误。

进入Linux维护模式的方法包括:1.编辑GRUB配置文件,添加"single"或"1"参数并更新GRUB配置;2.在GRUB菜单中编辑启动参数,添加"single"或"1"。退出维护模式只需重启系统。通过这些步骤,你可以在需要时快速进入维护模式,并安全地退出,确保系统的稳定性和安全性。

Linux的核心组件包括内核、shell、文件系统、进程管理和内存管理。1)内核管理系统资源,2)shell提供用户交互界面,3)文件系统支持多种格式,4)进程管理通过fork等系统调用实现,5)内存管理使用虚拟内存技术。


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SecLists
SecLists是最终安全测试人员的伙伴。它是一个包含各种类型列表的集合,这些列表在安全评估过程中经常使用,都在一个地方。SecLists通过方便地提供安全测试人员可能需要的所有列表,帮助提高安全测试的效率和生产力。列表类型包括用户名、密码、URL、模糊测试有效载荷、敏感数据模式、Web shell等等。测试人员只需将此存储库拉到新的测试机上,他就可以访问到所需的每种类型的列表。

螳螂BT
Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境

SublimeText3汉化版
中文版,非常好用