• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

phar Command Examples in Linux

by Deepika

The phar (PHP Archive) is a format used for distributing and packaging PHP applications. A phar file is a single archive that contains all of the necessary components of a PHP application, including the PHP code, resources, and dependencies.

The phar extension in PHP provides the ability to create, update, and extract phar archives. Using the phar extension, you can package a PHP application into a single file that can be easily distributed and executed.

phar Command Examples

1. Add space-separated files or directories to a Phar file:

# phar add -f path/to/phar_file files_or_directories

2. Display the contents of a Phar file:

# phar list -f path/to/phar_file

3. Delete the specified file or directory from a Phar file:

# phar delete -f path/to/phar_file -e file_or_directory

4. Display full usage information and available hashing/compression algorithms:

# phar help

5. Compress or uncompress files and directories in a Phar file:

# phar compress -f path/to/phar_file -c algorithm

6. Get information about a Phar file:

# phar info -f path/to/phar_file

7. Sign a Phar file with a specific hash algorithm:

# phar sign -f path/to/phar_file -h algorithm

8. Sign a Phar file with an OpenSSL private key:

# phar sign -f path/to/phar_file -h openssl -y path/to/private_key

Filed Under: Linux

Some more articles you might also be interested in …

  1. User Unable To Edit crontab, Error: “/tmp/crontab.Lm34gsJV: Permission denied”
  2. lvm Command Examples in Linux
  3. How to enable md5 Hashing in Linux
  4. uname: command not found
  5. doctl compute droplet: List, create, and delete virtual machines which are called droplets
  6. dcfldd: Enhanced version of dd for forensics and security
  7. pdftoppm Command Examples in Linux
  8. homectl Command Examples in Linux
  9. ssh-copy-id: command not found
  10. “az term” Command Examples (Manage marketplace agreement with marketplaceordering)

You May Also Like

Primary Sidebar

Recent Posts

  • gml2gv Command Examples
  • glow Command Examples
  • glib-compile-resources Command Examples
  • glances Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright