3

What do lines such as "-y" or "-r" placed in the CLI do? I am learning Linux from the ground up (sort of) and want a solid understanding of what I'm typing into the Terminal. I have been looking up ways to customize and retrieve/install things and have found things like "tar -tvf" or "yum -y" followed by a program or file. Any clarity on this would be much appreciated.

  • Those are options to the commands like tar or yum. They are very command-dependent, even though a few ones can be somewhat standard (such as -h that often gives you some help about the command). – user2233709 Apr 03 '17 at 20:56
  • the r could mean recursive (tar, zip, ...), the y assume-yes (apt, yum). There is no general rule, you'ld rather check for the man pages of your commands. – SYN Apr 03 '17 at 20:57
  • Thank you all! This is exactly what I needed to get started. I appreciate the quick responses! – pjsansman Apr 03 '17 at 21:08
  • if man [command] doesn't find anything try [command] -h or [command] --help. – quixotic Apr 03 '17 at 21:25

1 Answers1

5

It is very simple, these are command parameters (aka options or flags). It is convention that they start with minus, but one minus can be followed by several options. ls means list; ls -a means list all, that is including hidden files. ls -l means list in long format. Consequently ls -la means list all in long format. For rm - the remove command rm -r can be a dangerous option as it means remove (delete) recursively - so if you are root you could delete the entire filesystem if you are not paying attention with rm -rf *as described here. For every command specifics can be found in manpages such as man ls. You get used to reading those and quickly find specifics with / to find inside a manpage, then n will seek next occurrence of the search string. Exit manpage with q for quit. Also many commands and their examples you can search for with Google - just surround the search with quotes if it includes whitespace. One of the first things you can learn about is chaining (properly called piping) - how output from one command goes into the next separated​ by | the pipe symbol. Then it all starts to make much sense. A good place for various examples is bashOneLiners. Good luck!

r0berts
  • 730
  • 1
    Thanks for the explanation. Wish I could upvote with my small rep. This is just what a noobie needed to get started. Much appreciated! – pjsansman Apr 03 '17 at 21:22
  • It's ok. If it helps you can just accept. Also do not hesitate to ask more and experiment. People will be happy to help. – r0berts Apr 03 '17 at 21:23