Commands tagged 7z (7)

  • Using 7z to create archives is OK, but when you use tar, you preserve all file-specific information such as ownership, perms, etc. If that's important to you, this is a better way to do it.


    8
    tar cf - /path/to/data | 7z a -si archivename.tar.7z
    slashdot · 2009-07-14 14:21:30 7
  • Create an image of "device" and send it to another machine through the network ("target" and "port" sets the ip and port the stream will be sent to), outputting a progress bar On the machine that will receive, compress and store the file, use: nc -l -p <port> | 7z a <filename> -si -m0=lzma2 -mx=9 -ms=on Optionally, add the -v4g switch at the end of the line in order to split the file every 4 gigabytes (or set another size: accepted suffixes are k, m and g). The file will be compressed using 7z format, lzma2 algorithm, with maximum compression level and solid file activated. The compression stage will be executed on the machine which will store the image. It was planned this way because the processor on that machine was faster, and being on a gigabit network, transfering the uncompressed image wasn't much of a problem.


    8
    dd if=<device> | pv | nc <target> <port>
    quitaiskiluisf · 2012-01-27 18:37:36 18
  • Creates a solid archive with the highest possible compression (Ultra). Advantage of 7z is that it will use all the processor cores to create the archive. (Ok. at least version 9.04 does) Show Sample Output


    2
    7z a -mx=9 -ms=on archive.7z files_for_archiving/
    nssy · 2011-10-22 09:26:42 5
  • Compress files or a directory to xz format. XZ has superior and faster compression than bzip2 in most cases. XZ is superior to 7zip format because it can save file permissions and other metadata data.


    1
    tar -cJf myarchive.tar.xz /path/to/archive/
    Sepero · 2014-03-13 03:34:18 6
  • compress directory archive with xz compression, if tar doesn't have the -J option (OSX tar doesn't have -J)


    1
    tar -cvf - /path/to/tar/up | xz - > myTarArchive.tar.xz
    razerwolf · 2014-03-18 19:51:50 7
  • Magic line will extract almost all possible archives from current folder in its own folders. Don't forget to change USER name in sudo command. sed is used to create names for folders from archive names w/o extension. You can test sed expression, used in this command: arg='war.lan.net' ; x=$(echo $arg|sed 's/\(.*\)\..*/\1/') ; echo $x If some archives can't be extracted, install packages: apt-get install p7zip-full p7zip-rar Hope this will save a lot of your time. Enjoy.


    0
    for ARG in * ; do sudo -u USER 7z x -o"$(echo $ARG|sed 's/\(.*\)\..*/\1/')" "$ARG" ; done
    n158 · 2012-12-31 19:47:24 7
  • Create a 7zip archive named "some_directory.7z" and adds to it the directory "some_directory". The `-mhe=on` is for header encryption, basically it mangles the file names so no one knows whats inside the 7z. If -mhe=on wasn't included, then a person without the password would still be able to view the file names inside the 7z. Having this option ensures confidentiality. To ensure the result is small use lzma2, level 9 compression. Lzma2 fast bytes range from 5 to 272, the higher the number the more aggressive it is at finding repetitive bytes that can be added to the dictionary. Here the fast bytes are set to 64 bytes and the dictionary is 32 MB. Depending on your purposes (the directory size and desired file size), you can be more aggressive with these values. Lastly, `-ms=on` just says concatenate all the individual files and treat them as a singular file when compressing. This leads to a higher compression ratio generally.


    0
    7z a -t7z -mhe=on -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on some_directory.7z some_directory/
    keyboardsage · 2024-03-16 23:36:38 16

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

Perl One Liner to Generate a Random IP Address

Create thumbnails and a HTML page for listing them (with links to sources)
The input images are assume to have the "JPG" extension. Mogrify will overwrite any gif images with the same name! Will not work with names with spaces.

Download all PDFs from an authenificated website
Replace *** with the appropiate values

Alias for lazy tmux create/reattach
If a tmux session is already running attach it, otherwise create a new one. Useful if you often forget about running tmuxes (or just don't care)

Install a LAMP server in a Debian based distribution
The execution of this command will install a LAMP server (Linux, Apache, MySQL and PHP) in a Debian based distribution. For example, in Ubuntu.

find text in a file
this will find text in the directory you specify and give you line where it appears.

locating packages held back, such as with "aptitude hold "
locating packages held back, such as with "aptitude hold "

Readd all files is missing from svn repo
When working on a big proeject with SVN, you create quite much files, for now! Can just sit here and type svn add for all of them! svn status will return a list of all of file which get ?(not add), "M"(Modified), "D"(Deleted)! This code just grep "?" flag, then add it into SVN again!

back ssh from firewalled hosts
host B (you) redirects a modem port (62220) to his local ssh. host A is a remote machine (the ones that issues the ssh cmd). once connected port 5497 is in listening mode on host B. host B just do a ssh 127.0.0.1 -p 5497 -l user and reaches the remote host'ssh. This can be used also for vnc and so on.


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: