This question already has answers here:
What is a simple explanation for how pipes work in Bash?
(11 answers)
Closed last year.
I know for example: ls -all | grep Hello means to search all files containing Hello. What is the definitive definition of the | command? What exactly is going on here with |?
pipe; send whatever we get from the left side to the right side: (https://www.makeuseof.com/what-are-linux-metacharacters/) I would also take a look at the gnu bash manual: https://www.gnu.org/software/bash/manual/bash.html and check specifically the 3.2.3 Pipelines for more in depth information
Related
This question already has answers here:
What's the magic of "-" (a dash) in command-line parameters?
(5 answers)
Closed 1 year ago.
I tried to add generated ssh id_rsa to the gitlab-ci.
Command I have found is echo "$SSH_PRIVATE_KEY" | ssh-add -.
I can not find any information about param - that was added to command ssh-add.
How can I interprate this?
In a man I have found information about running it without any argument and some flags but add single dash is not describe there.
I used ubuntu latest image for this process
As #Aaron said
It's a reference to the standard input of the command, so the output of the piped echo
This question already has answers here:
Getting pids from ps -ef |grep keyword
(6 answers)
Closed 3 years ago.
I'm little bit new in sql command so please help me to clear this doubt
ps -ef|grep tomcat
This is not a SQL command,it's an unix/linux command check out forum answer below can clear your doubts.
https://askubuntu.com/questions/852206/what-does-ps-efgrep-processname-mean
In short :
look for lines containing processname in a detailed overview/snapshot of all current processes, and display those lines in linux command prompt environment
ps -ef says list all of the processes. (The -e option means every process, and the -f means use the "full" format in the listing.)
| says pipe the output of the previous command to the next command
grep tomcat say show (i.e. write to output) only those lines in the command's input that contain the string tomcat.
Combined, it means "show me the tomcat processes".
The "secret" to understanding a complicated Linux command is:
Understand the shell syntax; i.e. how |, <, >, $ and so on work.
Break the command line into its commands
Look up and read the manual entry for each command.
This question already has answers here:
Parsing JSON with Unix tools
(45 answers)
Closed 4 years ago.
I have this input
[{"email":"etu#etu"},{"email":"hg"},{"email":"ismail"}]
and I want to extract only the value on the email using bash.
Simply with jq:
echo '[{"email":"etu#etu"},{"email":"hg"},{"email":"ismail"}]' | jq -r '.[].email'
The output:
etu#etu
hg
ismail
I recommend you use some unix tool for this and invoke it in your bash process.
Check this out: json command line processor
You probably want to investigate this one and you'll be probably good to go.
This question already has answers here:
What does the Bash operator <<< (i.e. triple less than sign) mean?
(3 answers)
Closed 2 years ago.
I get the following code to get a fingerprint from private key of OpenSSH.
$ key=`ssh-keygen -yf ~/.ssh/id_rsa`; ssh-keygen -lf /dev/stdin <<<$key
However, I do not know <<< $key syntax.
What behavior is this? Is there a web site that explains this syntax?
From man bash:
Here Strings
A variant of here documents, the format is:
<<<word
The word is expanded and supplied to the command on its standard input.
This question already has answers here:
Is there a "standard" format for command line/shell help text?
(11 answers)
Closed 7 years ago.
What is the convention for showing the usage of a bash script ?
Below is the help output for my script
Usage: my_script [options] [PORT]
Options:
--help print help and exit
--version print version and exit
Am i right in thinking that [ ] means optional
How do I signify an optional argument and a mandatory argument ?
A couple of commandline tools that i use frequently is "find" and "grep". While find runs happy without any parameters (all parameters are optional) grep needs at least a pattern. In case grep is invoked with no paramters at all it prints usage information like follows
Aufruf: grep [OPTION]... MUSTER [DATEI]...
"grep --help" liefert weitere Informationen.
Where MUSTER is the german word for pattern.