- To compress and decompress several utilities are available in Linux. Most software for Linux systems uses the GNU gzip and gunzip utilities
- To compress the files gzip utility and to decompress compressed files gunzip utility is used
- To compress a file, enter the command gzip and the filename. This replaces the file with a compressed version of it, with the extension .gz. In the following example the file suvarni is compressed and the new compressed file is suvarni.gz
Example: gzip suvarni
- To decompress a compressed file, you can use either gzip with the -d option or the command gunzip. These commands decompress a compressed file with the .gz extension and replace it with a decompressed version with the same root name, but without the .gz extension
- When you use gunzip, you need not type in the .gz extension because gunzip and gzip -d assume it. In the following example suvarni.gz file is decompressed
Example: gunzip suvarni.gz
- If you want to display or print the contents of a compressed file without first decompressing it. You can do this with the command zcat which generates a decompressed version of a file and sends it to the standard output. You can then redirect this output to a printer or display a utility such as more. But the original file remains in its compressed form
Example: zcat suvarni.gz | more
- You can also compress an archived tar files. This results in files with the extensions .tar.gz. These compressed archived files are generally used for transmitting extremely large files across networks
- In the following example the archived file krtihi.tar is compressed. The new file will have an extension krithi.tar.gz
Example: gzip krithi.tar
- You can even compress tar file members individually using the tar z option which invokes gzip. For this the z option be used, tar invokes gzip to compress a file before placing it in an archive
- Archives with members compressed with the z option, however, can neither be updated nor added to. All members must be compressed and all must be added at the same time
Linux : ps command
Linux: kill command
- If you want to stop a specific process then you can reference the system process number in a kill command
- In the next example the process 567 is terminated
Example: kill 567
Linux: SU (Switch User)
- While you are logged into a regular user account, sometimes it may be necessary for you to log into the root and become a superuser. Generally, you would have to log out of your user account first, and then log into the root
- Instead, you can use the su command (switch user) to log in directly to the root while remaining logged into your user account
- A CTRL-D or exit command returns you to your own login
- When logged in as the root, you can use su to log in as any user, without providing the password
Linux: Filter commands cut, wc, spell and sort << Previous
Next>> Linux: split and Paste command
Our aim is to provide information to the knowledge
seekers.