![Forrest logo](/images/logo.png)
parallel:tldr:7ae52
This command performs two operations using the ls
and parallel
commands:
-
ls *.txt
: Lists all the files in the current directory that have the ".txt" file extension. Thels
command lists the names of files and directories within a specified directory. -
|
: The pipe symbol (|
) redirects the output of the previous command (ls *.txt
) as input to the next command (parallel -j4 gzip
). -
parallel -j4 gzip
: Theparallel
command is used to execute multiple jobs (commands) in parallel. In this case, it takes the list of files generated byls *.txt
and runs thegzip
command to compress each file. The-j4
flag inparallel
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.