Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quick search of command options in bash

Tags:

bash

manpage

I found myself in a situation where I constantly look for parameters of a command in bash. For instance, find -type f -name '*py' -print0. In order to find all of those I need to go through man,info, or --help option which is laborious and time consuming. Is there any way to make this search instant. Ideally, I would love to see something like: find -type --help stating help on type option of find.

like image 561
Sergey Ivanov Avatar asked Jul 07 '13 06:07

Sergey Ivanov


People also ask

How do I search for something in bash?

You need to utilize the “-L” option and the path and “-name” option in your command. The “*” in the name specification is used for searching “all” the bash files with “.

What is $() in bash?

$() means: "first evaluate this, and then evaluate the rest of the line". Ex : echo $(pwd)/myFile.txt. will be interpreted as echo /my/path/myFile.txt. On the other hand ${} expands a variable.

What is $_ in bash?

$_ (dollar underscore) is another special bash parameter and used to reference the absolute file name of the shell or bash script which is being executed as specified in the argument list. This bash parameter is also used to hold the name of mail file while checking emails.

What is $1 and $2 in bash?

$0 is the name of the script itself (script.sh) $1 is the first argument (filename1) $2 is the second argument (dir1)


1 Answers

If your man pages open in less you can use / to search over it.

man find

/-type

n, for next search

N for previous search

like image 147
Blaz Balon Avatar answered Sep 30 '22 01:09

Blaz Balon