tar

Overwritten file with tar

别说谁变了你拦得住时间么 提交于 2019-12-24 18:37:07
问题 I was trying to tar a file and ended up overwriting it. I was working in Xcode and I'm wondering if there is a way for me to recover the overwritten file. 回答1: Unless you saved it somewhere else, its unlikely. sorry 回答2: Yes, from your backups which, of course, you do regularly and frequently, right? On second thoughts, you probably don't, so you're fresh out of luck. I'd look on this as an opportunity to change your backup practices :-). 回答3: If you mean that you added the same file twice in

Linux和Docker常用命令

≯℡__Kan透↙ 提交于 2019-12-24 16:46:16
一、常用Linux 命令   ls   -a(同时列出隐含文件),  -l(输出一个比较完整的格式,除每个文件名外,增加显示文件      类型、权限、硬链接数、所有者名、组名、大小(byte)、及时间信息-----简化为 ll)   mkdir    新建目录 例:mkdir test 命令会在当前目录下建立一个名为“test”的新目录      touch   创建文件 例:touch test/readme.txt 在 test 目录下创建 readme.txt文件   cd   切换目录 cd /. 到根目录 cd .. 上一级目录 cd /hahaha/hahaha 到指定目录    pwd   显示当前目录   mv   移动/重命名(加上 -i 参数询问是否覆盖)  mv hello rock/ 移动到rock目录下        mv hello rock 重命名为rock   cp   拷贝 (加上 -i 参数询问是否覆盖,-r 参数递归调用)        cp -ir test/ workspace"(递归复制 test 目录到 workpace 目录下并在覆盖时提示)   rm   删除 (加上 -i 参数确认提示,-r 参数递归调用)         rm -ir test/ 递归删除test目录及其子目录并询问   wget url  下载文件到当前目录

Tar and --newer / --after-date parameter

北城以北 提交于 2019-12-24 16:28:50
问题 My project structure is the following: -sprint41 -file1 -file2 -sprint40 -file1 -file2 All my files(+ sprint41) in sprint41 folder have a modified date 20130807 All my files(+ sprint40) in sprint40 folder have a modified date 20130610 I want to create an archive including all the files(+folder) after 20130715. My command is the following: tar -cf test.tar --after-date 20130715 * After this command, test.tar contains the following: -sprint41 -file1 -file2 -sprint40 It is keeping sprint40

CentOS日常维护及常用脚本

最后都变了- 提交于 2019-12-24 13:58:09
[root@192-16.x.x xiewenming]# curl myip.ipip.net 当前 IP:42.62.x.x 来自于:中国 北京 北京 联通/电信 www.17ce.com cdn解析网站测试 如果遇到 -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory,解决办法如下: vi /etc/environment add these lines... LANG=en_US.utf-8 LC_ALL=en_US.utf-8 结束php进程,主进程除外 ps -ef|grep php|grep -v grep|cut -c 9-15|xargs kill -9 用指定用户执行脚本或命令 su - tomcat -c /usr/local/tomcat/bin/startup.sh 切换root执行 sudo sh tomcat.sh start 查查哪个目录的inode节点使用的多 [root@opt]# df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/vda2 576K 497K 80K 87% / tmpfs 235K 5 235K 1% /dev/shm [root

Adding files to a Tar Archive in PHP with different filenames

与世无争的帅哥 提交于 2019-12-24 12:58:46
问题 I'm currently using the Archive-Tar Pear extension for PHP to add a collection of files into a Tar Archive. These files are stored on a filer with an extra extension e.g. filename.tgz.104850209.t or filename2.doc.2154395.t I'd like to remove this extra extension while adding the files so that my Tar Archive would have the files: filename.tgz and filename2.doc Is there a way of doing that without having to copy/rename the source files first before adding to the Archive? Thanks, Mark. 回答1:

How to extract a tar file inside a tar file

冷暖自知 提交于 2019-12-24 12:19:58
问题 I need help to extract a tar file inside a tar. I can extract the parent tar and then untar the child tar but trying to see if there any way to just extract the child tar without untaring parent tar.. eg: tar -tf parent.tar parent/ parent/child.tar parent/file1 parent/file2 parent/file3 回答1: You should add an argument to match the file inside the tar and use -O or --to-stdout to extract data to stdout to pipe and use another tar to extract it: tar -xOf parent.tar parent/child.tar | tar -x 来源:

ant tar task: way to enable “tar append”?

陌路散爱 提交于 2019-12-24 08:08:20
问题 Goal: use ant to create a single tar archive for any combination of (say) 5 folders (all folders, or any 3 folders or any 4 folders ...). I prefer not using temp dirs and the copy command. This should be simple if the ant tar task supports append. A search lead me to: Setting mode="update" in the compress antlib's tar task should do what is requested. from: https://issues.apache.org/bugzilla/show_bug.cgi?id=39617 How do I know if 'antlib' is installed, or how do I install it. How does one set

tar: Cowardly refusing to create an empty archive

我与影子孤独终老i 提交于 2019-12-24 07:00:38
问题 I use the following tar command to try to backup my entire file system tar -cvpzf test/backup.tar.gz --exclude=/test And I receive the following error message tar: Cowardly refusing to create an empty archive Try 'tar --help' or 'tar --usage' for more information. Can somebody point me in the right direction as to how to use tar and explain why it's trying to create an empty archive? 回答1: You defined what to exclude, but didn't define what you actually want in the archive. Supply at least one

Linux Shell——流程控制

南楼画角 提交于 2019-12-24 04:33:27
一. 创建交互式脚本 使用 echo命令的选项 关于各种命令的使用,可以使用 man 命令 来查看命令的详细用法介绍。例如,我想看下 echo 的用法和各种选项。可以执行 man echo 。执行结果如下: 如果单独执行 echo 命令,就会打印出一个空白行。 默认情况下,echo 都会换行,如果不想换行的话,可以使用下面两种方式的一种。 echo -n "Which directory do you want to use? " echo -e "Which directory do you want to use? \c" 使用 read 命令 如果我们需要读入用户输入的参数时,可以使用 read 命令,当然还可以从文件系统等读入信息。 我们建立一个新的脚本文件 hello3.sh。 #!/bin/bash echo -n "Hello I $(basename $0) may I ask your name: " read echo "Hello $REPLY" exit 0 执行此脚本时,首先提示需要输入,然后输入的内容, REPLY 当没有给 read 提供参数时设置,最后打印出来。 执行结果为: 优化 read 提示的脚本 在前面的例子中,我们使用了 echo -n 的方式来阻止信息换行,其实 read 命令也带了一个选项来实现相同的功能: read -p "Enter

linux的压缩与解压缩

无人久伴 提交于 2019-12-24 00:55:44
linux压缩与解压缩是非常重要的内容。以下内容是经常遇到的,需熟悉并记住。 tar.xz 压缩: tar cJvf filename.tar.xz dirname 解压 tar xvJf ***.tar.xz .tar 打包: tar cvf filename.tar dirname 解包: tar xvf filename.tar (tar是打包,不是压缩!) .tar.gz 压缩: tar czvf filename.tar.gz DirName 解压: tar xzvf filename.tar.gz .tar.bz2 压缩: tar cjvf filename.tar.bz2 dirname 解压: tar xjvf filename.tar.bz2 .tar.bz 解压: tar xjvf filename.tar.bz .gz 压缩: gzip filename 解压: gunzip filename.gz 或者 gzip -d filename.gz .bz2 压缩: bzip2 -z filename 解压: bunzip2 filename.bz2 或者 bzip2 -d filename.bz2 .bz 解压: bzip2 -d filename.bz 或者 bunzip2 filename.bz .zip 压缩: zip filename.zip