What are common command-line arguments?

099

Here are some common command-line arguments that are widely used across various command-line utilities:

  1. -h or --help: Displays help information about the command, including usage and available options.

    command --help
  2. -v or --version: Shows the version of the command or program.

    command --version
  3. -f: Often used to force an action, such as overwriting files without prompting.

    rm -f filename.txt  # Force delete a file
  4. -r or --recursive: Used to perform actions recursively, such as deleting directories and their contents.

    rm -r directory_name  # Recursively delete a directory
  5. -i: Prompts for confirmation before executing an action, often used with delete commands.

    rm -i filename.txt  # Ask for confirmation before deleting
  6. -n NUM: Specifies a number, such as the number of lines to display or process.

    head -n 10 filename.txt  # Show the first 10 lines
  7. -q or --quiet: Suppresses output messages, making the command run quietly.

    command -q  # Run quietly without output
  8. -o: Often used to specify an output file for commands that generate output.

    command -o output.txt  # Redirect output to a file

These arguments can vary by command, so it's always a good idea to check the help documentation for specific commands to understand their options. If you have a particular command in mind, feel free to ask!

0 Comments

no data
Be the first to share your comment!