Forrest logo
back to the ls tool

parallel:tldr:7ae52

parallel: Read arguments from `stdin`, run 4 jobs at once.
$ ls *.txt | parallel -j4 gzip
try on your machine

This command performs two operations using the ls and parallel commands:

  1. ls *.txt: Lists all the files in the current directory that have the ".txt" file extension. The ls command lists the names of files and directories within a specified directory.

  2. |: The pipe symbol (|) redirects the output of the previous command (ls *.txt) as input to the next command (parallel -j4 gzip).

  3. parallel -j4 gzip: The parallel command is used to execute multiple jobs (commands) in parallel. In this case, it takes the list of files generated by ls *.txt and runs the gzip command to compress each file. The -j4 flag in parallel specifies that four jobs should be run in parallel.

Therefore, the complete command finds all the files with a ".txt" file extension in the current directory, and then compresses each of them using the gzip command, with up to four compressions being done in parallel at a time.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ls tool