Final answer:
To tar multiple files and directories in Linux, use the 'tar' command with the '-c' option to create a new archive, '-v' for verbose output, and '-f' followed by the filename. You can add files and directories to the archive by listing them after the command options.
Step-by-step explanation:
To tar multiple files and directories on a Linux system, you use the 'tar' command followed by various options that specify how the tarball should be created. To create a new tar archive, the -c option is used. The -v option provides verbose output, listing files as they are added, and the -f option is followed by the desired filename of the archive. For example, if you wish to tar the directories 'dir1' and 'dir2' along with the files 'file1.txt' and 'file2.txt', your command would look like this:
tar -cvf archive_name.tar dir1 dir2 file1.txt file2.txt
This command creates an archive named 'archive_name.tar' containing the specified directories and files. To add compression, you can use the -z option for gzip, -j for bzip2, or -J for xz. For example, to create a gzip-compressed tar archive, the command would become:
tar -cvzf archive_name.tar.gz dir1 dir2 file1.txt file2.txt