tar

add tar/gzip to windows command line

◇◆丶佛笑我妖孽 提交于 2019-12-01 12:28:05
问题 As the title says - anyone know of a method to add tar/gzip to the command line in Windows? I've installed Cygwin - but don't know if I have to add something to the PATH env variable to get tar as a cmd option 回答1: Install UnxUtils - it's a set of GNU utilities ported to Windows, sort of like Cygwin but they also work outside the Cygwin environment. 回答2: The method I've used to solve this is to install Cygwin then place the path to the bin directory in the PATH variable. 回答3: 9 years later

Linux常用命令大全

旧街凉风 提交于 2019-12-01 12:19:50
Linux常用命令大全(非常全!!!) 最近都在和Linux打交道,感觉还不错。我觉得Linux相比windows比较麻烦的就是很多东西都要用命令来控制,当然,这也是很多人喜欢linux的原因,比较短小但却功能强大。我将我了解到的命令列举一下,仅供大家参考: 系统信息 arch 显示机器的处理器架构 uname -m 显示机器的处理器架构 uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统部件 - (SMBIOS / DMI) hdparm -i /dev/hda 罗列一个磁盘的架构特性 hdparm -tT /dev/sda 在磁盘上执行测试性读取操作 cat /proc/cpuinfo 显示CPU info的信息 cat /proc/interrupts 显示中断 cat /proc/meminfo 校验内存使用 cat /proc/swaps 显示哪些swap被使用 cat /proc/version 显示内核的版本 cat /proc/net/dev 显示网络适配器及统计 cat /proc/mounts 显示已加载的文件系统 lspci -tv 罗列 PCI 设备 lsusb -tv 显示 USB 设备 date 显示系统日期 cal 2007 显示2007年的日历表 date 041217002007.00 设置日期和时间 - 月日时分年

Read contents of tar file without unzipping to disk

大兔子大兔子 提交于 2019-12-01 11:58:37
I have been able to loop through the files in a tar file, but I am stuck on how to read the contents of those files as string. I would like to know how to print the contents of the files as a string? This is my code below package main import ( "archive/tar" "fmt" "io" "log" "os" "bytes" "compress/gzip" ) func main() { file, err := os.Open("testtar.tar.gz") archive, err := gzip.NewReader(file) if err != nil { fmt.Println("There is a problem with os.Open") } tr := tar.NewReader(archive) for { hdr, err := tr.Next() if err == io.EOF { break } if err != nil { log.Fatal(err) } fmt.Printf("Contents

Read contents of tar file without unzipping to disk

╄→гoц情女王★ 提交于 2019-12-01 10:47:12
问题 I have been able to loop through the files in a tar file, but I am stuck on how to read the contents of those files as string. I would like to know how to print the contents of the files as a string? This is my code below package main import ( "archive/tar" "fmt" "io" "log" "os" "bytes" "compress/gzip" ) func main() { file, err := os.Open("testtar.tar.gz") archive, err := gzip.NewReader(file) if err != nil { fmt.Println("There is a problem with os.Open") } tr := tar.NewReader(archive) for {

easy-copy服务器文件拷贝简易小工具

馋奶兔 提交于 2019-12-01 10:07:43
github:easy-copy import os import sys import time import paramiko as pm ''' host格式: { "ip":"127.0.0.1", "port":22, "username":"root", "password":"123456", "file":"filename" } dst为host列表 要求: 源主机需要部署sshpass、scp 本机需要python3.4及以上,以及安装paramiko库 各源主机及目的主机能互联互通,ssh安全连接过 ''' # 默认运行配置:源 example_src = { "ip": "10.112.98.132", "port": 22, "username": "root", "password": "111", "file": "/root/111.o" } # 默认运行配置:目的,数组 example_dst = [ { "ip": "10.112.98.134", "port": 22, "username": "root", "password": "222", "file": "/root/222.o" }, { "ip": "10.112.98.151", "port": 22, "username": "root", "password": "333",

linux解压命令

我只是一个虾纸丫 提交于 2019-12-01 10:07:18
1、*.tar 用 tar -xvf 解压 2、*.gz 用 gzip -d或者gunzip 解压 3、*.tar.gz和*.tgz 用 tar -xzf 解压 4、*.bz2 用 bzip2 -d或者用bunzip2 解压 5、*.tar.bz2用tar -xjf 解压 6、*.Z 用 uncompress 解压 7、*.tar.Z 用tar -xZf 解压 8、*.rar 用 unrar e解压 9、*.zip 用 unzip 解压 来源: https://www.cnblogs.com/grapelet520/p/11678892.html

How do I prevent tar from overwriting an existing archive?

人走茶凉 提交于 2019-12-01 09:19:39
I backup files a few times a day on Ubuntu/Linux with the command tar -cpvzf ~/Backup/backup_file_name.tar.gz directory_to_backup/ , (the file name contains the date in YYYY-MM-DD format and a letter from a to z - a is the first backup for this date etc.) but I want to create a new archive, not overwrite the archive if it already exists. How do I prevent tar from overwriting an existing archive? If the archive exists, I want tar to exit without doing anything (and if possible, display an error message). Check the existence of the file beforehand: if [ -f ~"/Backup/[backup_file_name].tar.gz" ];

Linux的tar压缩解压缩命令

可紊 提交于 2019-12-01 08:38:29
tar 命令语法如下: # tar <选项> <文件> 下面列举 tar 命令中一些常用的选项: --delete : 从归档文件 (而非磁带) 中删除 -r, --append : 将文件追加到归档文件中 -t, --list : 列出归档文件中包含的内容 --test-label : 测试归档文件卷标并退出 -u, --update : 将已更新的文件追加到归档文件中 -x, --extract, --get : 释放归档文件中文件及目录 -C, --directory=DIR : 执行归档动作前变更工作目录到 DIR -f, --file=ARCHIVE : 指定 (将要创建或已存在的) 归档文件名 -j, --bip2 : 对归档文件使用 bzip2 压缩 -J, --xz : 对归档文件使用 xz 压缩 -p, --preserve-permissions : 保留原文件的访问权限 -v, --verbose : 显示命令整个执行过程 -z, gzip : 对归档文件使用 gzip 压缩 注 : 在 tar 命令选项中的连接符 - 是可选的(LCTT 译注:不用 - 也没事。这在 GNU 软件里面很罕见,大概是由于 tar 命令更多受到古老的 UNIX 风格影响)。 参考链接: https://www.jb51.net/article/97215.htm tar -c:

create tar file from stdin

僤鯓⒐⒋嵵緔 提交于 2019-12-01 08:32:16
问题 I want to backup mysql to a tape on-the-fly. Some like mysqldump|tar --filename=mysqlbackup.sql > /dev/tape I want the tape has content a tar file and this file has content "mysqldump.sql" So a command "tar -t < /dev/tape" should output mysqldump.sql I don't want at first save mysqldump to file, because I have no space and IO resources. I want to do it on-the-fly. I don't want "mysqldump > /dev/tape" because there is no metainfo and no way to know the tape has any content/ 回答1: User parkydr

tar

懵懂的女人 提交于 2019-12-01 07:25:17
gzip、bizp2只能对一个文件进行压缩,而不能对多个文件和目录进行压缩。 所以需要tar来对多个目录、文件进行打包和压缩。 tar常用选项 -c(create) 表示创建用来生成文件包 -x:表示提取,从文件包中提取文件 -t可以查看压缩的文件。 -z使用gzip方式进行处理,它与”c“结合就表示压缩,与”x“结合就表示解压缩。 -j使用bzip2方式进行处理,它与”c“结合就表示压缩,与”x“结合就表示解压缩。 -v(verbose)详细报告tar处理的信息 -f(file)表示文件,后面接着一个文件名。 -C <指定目录> 解压到指定目录 1.tar打包、gzip压缩 1)压缩 tar -czvf 压缩文件名 目录名 如: tar czvf dira.tar.gz dira 注意: tar -czvf 与 tar czvf 是一样的效果,所以说,后面统一取消-。 2)查看 tar tvf 压缩文件名 如: tar tvf dira.tar.gz 3)解压 tar xzvf 压缩文件名 tar xzvf 压缩文件名 -C 指定目录 如: tar xzvf dira.tar.gz 解压到当前目录 如: tar xzvf dira.tar.gz -C /home/book 解压到/home/book 2.tar打包、bzip2压缩 1)压缩 tar cjvf 压缩文件名 目录名