9

I'm going through a video to learn about commands, and I noticed that when the guy inputs a command, most of them have the -v option by default, without him actually inputting -v in the command options.

He mentioned that he enabled "verbose", but I can't seem to find anything online that mentions what I'm looking for. I'm not sure if it is relevant, but I'm on a VM.

Video: https://www.youtube.com/watch?v=ZtqBQ68cfJc&t=5377s

How can I enable this verbose mode?

terdon
  • 98,183
  • 15
  • 197
  • 293
LBB188
  • 93
  • 5

1 Answers1

27

You don't. While many commands do use -v for verbose, and this is a common idiom, it isn't a standard and many commands use it for something completely different. For example, the text search command grep uses -v for "negate the match". So while grep foo means "find lines matching foo, the command grep -v foo means "find lines that do not match foo".

So you really don't want to blindly add an option to a command unless you know that command uses the option to do what you think it does. Instead, what you can do is add aliases for the commands you actually want to use. To do that, for example for the command gzip which was mentioned in your video, you edit the file $HOME/.bashrc and add this line:

alias gzip='gzip -v'

Save the file, open a new terminal, and now all your gzip commands become gzip -v.

And, to find out what options a command has and what they do, you run man command. So, for grep, that would be man grep.

terdon
  • 98,183
  • 15
  • 197
  • 293
  • Thank you, finished alias command and it all makes sense now. – LBB188 Apr 15 '23 at 01:32
  • `-v` is also a common short option for `--version` – phuclv Apr 17 '23 at 08:31
  • What about the second part of the question (in the title)? After setting that alias, how to run `gzip` without the `-v`? Do you need a second alias, or is there a way to say "ignore the aliases, just run gzip"? – user2554330 Apr 17 '23 at 08:50
  • @user2554330 see [How can I run original command that aliased with same name?](https://askubuntu.com/a/525242) – terdon Apr 17 '23 at 08:58