Score:0

Debian: Simple way to compress files wanted

ps flag

I often need to compress archives in Linux. is there a simpler way instead of always building such complicated commands?

tar zcvf /tmp/mybackup.tar.gz /home/important
in flag
Like, creating an alias?
Score:2
sd flag

An alias would mean you don't have to remember the zcvf options. You can name the alias whatever you want as long as it is one word.

Create the alias in your terminal with

alias archive='tar zcvf'

and then your command becomes

archive /tmp/mybackup.tar.gz /home/important

If you like this alias, make it permanent by adding it to your ~/.bashrc. (Or whatever config file is sourced by the shell you are using.) Then every new terminal you open will have the alias already configured and ready to use.

Nikita Kipriyanov avatar
za flag
A suggestion: use `acvpf` flags instead, so tar will determine a stream compressor from the file extension, and also to preserve permissions. The same alias would work for any archive type: `archive backup.tar.xz /files /to /backup` will commress with `xz`, while `archive anotherbackup.tar.zst /different /files` will use `zstd`. `gzip`, `bzip2`, `lzo` — all of them will work.
localarrow avatar
sd flag
Good idea @NikitaKipriyanov!
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.