Command-Line Operations

Archive files

Price range: €11.42 through €16.06
tar -cvf archive_name.tar file1.txt file2.txt file3.log

Explanation:

  • tar: The command used for creating and extracting archive files.
  • -c: Creates a new archive.
  • -v: Enables verbose mode, displaying the files being added to the archive.
  • -f: Specifies the filename of the archive.
  • archive_name.tar: The name of the tarball you want to create. Replace archive_name with your desired name for the archive file.
  • file1.txtfile2.txtfile3.log: These are the files to be archived. Replace these with the actual filenames you want to include in the archive.

Result:

This command will create a .tar archive named archive_name.tar containing the specified files (file1.txtfile2.txtfile3.log). The files will be archived in the current working directory unless full paths are provided.

Select options This product has multiple variants. The options may be chosen on the product page

Create a symbolic link

Price range: €16.62 through €20.06

Command:

bash
ln -s /path/to/source /path/to/destination

Explanation:

  • ln: The command used to create links between files or directories.
  • -s: This option creates a symbolic (or soft) link. A symbolic link points to the original file or directory and can span across filesystems.
  • /path/to/source: The source file or directory you want to link to. Replace this with the full path of the file or directory you want to create a symbolic link for.
  • /path/to/destination: The location where you want the symbolic link to be created. This can be a file or directory where you want to access the source via the symbolic link.

Result:

This command creates a symbolic link at the destination path that points to the source file or directory. The symbolic link behaves like a shortcut, allowing you to reference the source file or directory using the destination path.


Example:

To create a symbolic link named config_link that points to /etc/config/config_file in the current directory, you would use:

bash
ln -s /etc/config/config_file config_link
Select options This product has multiple variants. The options may be chosen on the product page

Extract files from an archive

Price range: €12.04 through €14.22

Command:

bash
tar -xvf archive_name.tar

Explanation:

  • tar: The command used for creating and extracting archive files.
  • -x: Extracts the contents of the archive.
  • -v: Verbose mode, which lists the files being extracted.
  • -f: Specifies the filename of the archive.
  • archive_name.tar: The name of the archive file from which you want to extract the contents. Replace archive_name with the actual name of your archive file (e.g., my_archive.tar).

Result:

This command will extract the contents of archive_name.tar into the current directory, displaying the list of files being extracted. If you wish to extract the contents to a specific directory, you can add the -C option followed by the directory path:

bash
tar -xvf archive_name.tar -C /path/to/destination/

This will extract the files into the specified directory (/path/to/destination/).

Select options This product has multiple variants. The options may be chosen on the product page