Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8635757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:03:20+00:00 2026-06-12T10:03:20+00:00

Can you use gzip to just compress text that you type into the terminal?

  • 0

Can you use gzip to just compress text that you type into the terminal?

If yes, then how?

If no, then what does this line mean?:

When you do not specify any files to be compressed or specify – as a file name, gzip reads from the standard input, compresses what is read, and writes the result out to the standard output.

I’ve read it on many web pages, including this one: http://www.mkssoftware.com/docs/man1/gzip.1.asp

Also, when I type gzip -f in my terminal, cursor goes to newline and starts accepting input but I just have to Ctrl+C it out and then nothing happens.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:03:21+00:00Added an answer on June 12, 2026 at 10:03 am

    Yes, you can, but it’s not a common thing to do.

    For example, this is perfectly legal (I typed “Hello, world.“, then Enter, then Ctrl-D).

    $ gzip > input.gz
    Hello, world.
    $ ls -l input.gz 
    -rw-r--r-- 1 kst kst 34 Oct  5 23:18 input.gz
    $ gzip -d < input.gz 
    Hello, world.
    

    (The compressed file is actually bigger than the input; this is common for very small inputs.)

    But remember that standard input doesn’t have to come from the keyboard. For example, the du command prints a summary of disk usage, and can generate a lot of output if you run it on a large directory. If you want to save the output directly in compressed form, you might type:

    du -a / | gzip > du-a.out.gz
    

    The standard input of the gzip command comes from the output of the du -a / command; its standard output is written to the new file du-a.out.gz.

    The tar command is another common example:

    tar cf - some_dir | gzip > some_dir.tar.gz
    

    (but many versions of tar have options to do this without having to explicitly invoke the gzip command).

    As for the last part of your question:

    Also, when I type gzip -f in my terminal, cursor goes to newline and starts accepting input but I just have to Ctrl+C it out and then nothing happens.

    Typing Ctrl-C kills the gzip process, and may not allow it to finish writing its output. You need to type Ctrl-D to trigger an end-of-file condition; this lets the gzip -f command finish normally. But you don’t generally want to do that; it will write the compressed output to your terminal, which can include control characters that can mess up your terminal settings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't get my site to use gzip compression. I recently watched this video
I use <gzip-compress-transformer/> <base64-encoder-transformer/> after a file connector, and then write a component to
I need to compress object[][] in C#. I can use Gzip comrepss- decompress a
I can use this command mysqldump -uroot myDB| gzip > mydb_`date +%d-%m-%Y`.sql.gz but when
Possible Duplicate: Deflate command line tool Yes, I know I can use PHP itself
I can use this maven plugin maven-jaxb-plugin to generate Java Classes from XSD file.
I haven't found similar queries, so quick question. Can you use any GZIP functions
I can use the following to get the contents of a folder with no
Users can use their Google, Facebook or Twitter account to login to a site
I can use .button() to create beautiful submit buttons, but the rest of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.