How to combine 4 commands into 1 in terminal while they are connected logicallyHow do I combine multiple grep commands?Rerun previous command under sudo12.04 Booting into TerminalHow to combine multiple commands in terminal?Why are none of my startup commands being executed?Combine 2 commands into 1 Custom command?Combine two commands into one commandSending Raw Commands to Connected PrnterCombine consecutive commands into script and run in MAC terminalFiltering Terminal Output and Writing to File
Bullying boss launched a smear campaign and made me unemployable
Mathematica command that allows it to read my intentions
Avoiding the "not like other girls" trope?
Different meanings of こわい
How could indestructible materials be used in power generation?
How can I prove that a state of equilibrium is unstable?
Did 'Cinema Songs' exist during Hiranyakshipu's time?
What Exploit Are These User Agents Trying to Use?
Does int main() need a declaration on C++?
How dangerous is XSS
Car headlights in a world without electricity
Could the museum Saturn V's be refitted for one more flight?
Can I hook these wires up to find the connection to a dead outlet?
What is the most common color to indicate the input-field is disabled?
Placement of More Information/Help Icon button for Radio Buttons
Implication of namely
Why didn't Boeing produce its own regional jet?
Knowledge-based authentication using Domain-driven Design in C#
What is the opposite of "eschatology"?
Send out email when Apex Queueable fails and test it
Convert seconds to minutes
how do we prove that a sum of two periods is still a period?
What is an equivalently powerful replacement spell for Yuan-Ti's Suggestion spell?
Can someone clarify Hamming's notion of important problems in relation to modern academia?
How to combine 4 commands into 1 in terminal while they are connected logically
How do I combine multiple grep commands?Rerun previous command under sudo12.04 Booting into TerminalHow to combine multiple commands in terminal?Why are none of my startup commands being executed?Combine 2 commands into 1 Custom command?Combine two commands into one commandSending Raw Commands to Connected PrnterCombine consecutive commands into script and run in MAC terminalFiltering Terminal Output and Writing to File
can someone help me? Have a H/w from my university. I have to put this 4 commands into 1:
grep - r - l 'TODO'
ln - s test *(It`s the name of file that I get after fisrt command)* softlink
grep -v -r -l 'TODO'
chmod 0644 lab *(It`s the name of file that I get after previous command)*
I tried to google this question but all I get was some stuff with ';' and '&'
But as I understood, it doens`t work in a proper way cause this commands are connected logicaly (I get the name of the file with which I have to work only after 'grep')
command-line grep
New contributor
Jekop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
can someone help me? Have a H/w from my university. I have to put this 4 commands into 1:
grep - r - l 'TODO'
ln - s test *(It`s the name of file that I get after fisrt command)* softlink
grep -v -r -l 'TODO'
chmod 0644 lab *(It`s the name of file that I get after previous command)*
I tried to google this question but all I get was some stuff with ';' and '&'
But as I understood, it doens`t work in a proper way cause this commands are connected logicaly (I get the name of the file with which I have to work only after 'grep')
command-line grep
New contributor
Jekop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
to filter output using grep you can type e.gls -la | grep 'myfile.txt'
– Bob91
1 hour ago
Could you elaborate a bit on what you are trying to do? It appears you are trying to search for a file with "TODO" in the file, then symlink that file to a file called "softlink". And finally change the permissions? Is that correct?
– Ryan J. Yoder
1 hour ago
add a comment |
can someone help me? Have a H/w from my university. I have to put this 4 commands into 1:
grep - r - l 'TODO'
ln - s test *(It`s the name of file that I get after fisrt command)* softlink
grep -v -r -l 'TODO'
chmod 0644 lab *(It`s the name of file that I get after previous command)*
I tried to google this question but all I get was some stuff with ';' and '&'
But as I understood, it doens`t work in a proper way cause this commands are connected logicaly (I get the name of the file with which I have to work only after 'grep')
command-line grep
New contributor
Jekop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
can someone help me? Have a H/w from my university. I have to put this 4 commands into 1:
grep - r - l 'TODO'
ln - s test *(It`s the name of file that I get after fisrt command)* softlink
grep -v -r -l 'TODO'
chmod 0644 lab *(It`s the name of file that I get after previous command)*
I tried to google this question but all I get was some stuff with ';' and '&'
But as I understood, it doens`t work in a proper way cause this commands are connected logicaly (I get the name of the file with which I have to work only after 'grep')
command-line grep
command-line grep
New contributor
Jekop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Jekop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Jekop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 2 hours ago
JekopJekop
1
1
New contributor
Jekop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Jekop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Jekop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
to filter output using grep you can type e.gls -la | grep 'myfile.txt'
– Bob91
1 hour ago
Could you elaborate a bit on what you are trying to do? It appears you are trying to search for a file with "TODO" in the file, then symlink that file to a file called "softlink". And finally change the permissions? Is that correct?
– Ryan J. Yoder
1 hour ago
add a comment |
to filter output using grep you can type e.gls -la | grep 'myfile.txt'
– Bob91
1 hour ago
Could you elaborate a bit on what you are trying to do? It appears you are trying to search for a file with "TODO" in the file, then symlink that file to a file called "softlink". And finally change the permissions? Is that correct?
– Ryan J. Yoder
1 hour ago
to filter output using grep you can type e.g
ls -la | grep 'myfile.txt'– Bob91
1 hour ago
to filter output using grep you can type e.g
ls -la | grep 'myfile.txt'– Bob91
1 hour ago
Could you elaborate a bit on what you are trying to do? It appears you are trying to search for a file with "TODO" in the file, then symlink that file to a file called "softlink". And finally change the permissions? Is that correct?
– Ryan J. Yoder
1 hour ago
Could you elaborate a bit on what you are trying to do? It appears you are trying to search for a file with "TODO" in the file, then symlink that file to a file called "softlink". And finally change the permissions? Is that correct?
– Ryan J. Yoder
1 hour ago
add a comment |
1 Answer
1
active
oldest
votes
You can use the pipe '|' to use the output of the first command as the input for the second command like this:
# <first command> | <second command> ...
This is only really helpful when<first command>produces standard output, and<second command>consumes standard input (I don't think that's the case forlnorchmodfor example: both need filename arguments)
– steeldriver
1 hour ago
@streeldriver why not ? If it is hard to handle the heavy output he can use a python command linepython -c ....to handle it... i think...
– Bob91
1 hour ago
If you did want to use a pipe, the simplest way would be to usexargsto turnstdininto an argument list
– steeldriver
1 hour ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Jekop is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1130731%2fhow-to-combine-4-commands-into-1-in-terminal-while-they-are-connected-logically%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use the pipe '|' to use the output of the first command as the input for the second command like this:
# <first command> | <second command> ...
This is only really helpful when<first command>produces standard output, and<second command>consumes standard input (I don't think that's the case forlnorchmodfor example: both need filename arguments)
– steeldriver
1 hour ago
@streeldriver why not ? If it is hard to handle the heavy output he can use a python command linepython -c ....to handle it... i think...
– Bob91
1 hour ago
If you did want to use a pipe, the simplest way would be to usexargsto turnstdininto an argument list
– steeldriver
1 hour ago
add a comment |
You can use the pipe '|' to use the output of the first command as the input for the second command like this:
# <first command> | <second command> ...
This is only really helpful when<first command>produces standard output, and<second command>consumes standard input (I don't think that's the case forlnorchmodfor example: both need filename arguments)
– steeldriver
1 hour ago
@streeldriver why not ? If it is hard to handle the heavy output he can use a python command linepython -c ....to handle it... i think...
– Bob91
1 hour ago
If you did want to use a pipe, the simplest way would be to usexargsto turnstdininto an argument list
– steeldriver
1 hour ago
add a comment |
You can use the pipe '|' to use the output of the first command as the input for the second command like this:
# <first command> | <second command> ...
You can use the pipe '|' to use the output of the first command as the input for the second command like this:
# <first command> | <second command> ...
answered 1 hour ago
Bob91Bob91
3861311
3861311
This is only really helpful when<first command>produces standard output, and<second command>consumes standard input (I don't think that's the case forlnorchmodfor example: both need filename arguments)
– steeldriver
1 hour ago
@streeldriver why not ? If it is hard to handle the heavy output he can use a python command linepython -c ....to handle it... i think...
– Bob91
1 hour ago
If you did want to use a pipe, the simplest way would be to usexargsto turnstdininto an argument list
– steeldriver
1 hour ago
add a comment |
This is only really helpful when<first command>produces standard output, and<second command>consumes standard input (I don't think that's the case forlnorchmodfor example: both need filename arguments)
– steeldriver
1 hour ago
@streeldriver why not ? If it is hard to handle the heavy output he can use a python command linepython -c ....to handle it... i think...
– Bob91
1 hour ago
If you did want to use a pipe, the simplest way would be to usexargsto turnstdininto an argument list
– steeldriver
1 hour ago
This is only really helpful when
<first command> produces standard output, and <second command> consumes standard input (I don't think that's the case for ln or chmod for example: both need filename arguments)– steeldriver
1 hour ago
This is only really helpful when
<first command> produces standard output, and <second command> consumes standard input (I don't think that's the case for ln or chmod for example: both need filename arguments)– steeldriver
1 hour ago
@streeldriver why not ? If it is hard to handle the heavy output he can use a python command line
python -c .... to handle it... i think...– Bob91
1 hour ago
@streeldriver why not ? If it is hard to handle the heavy output he can use a python command line
python -c .... to handle it... i think...– Bob91
1 hour ago
If you did want to use a pipe, the simplest way would be to use
xargs to turn stdin into an argument list– steeldriver
1 hour ago
If you did want to use a pipe, the simplest way would be to use
xargs to turn stdin into an argument list– steeldriver
1 hour ago
add a comment |
Jekop is a new contributor. Be nice, and check out our Code of Conduct.
Jekop is a new contributor. Be nice, and check out our Code of Conduct.
Jekop is a new contributor. Be nice, and check out our Code of Conduct.
Jekop is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1130731%2fhow-to-combine-4-commands-into-1-in-terminal-while-they-are-connected-logically%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
to filter output using grep you can type e.g
ls -la | grep 'myfile.txt'– Bob91
1 hour ago
Could you elaborate a bit on what you are trying to do? It appears you are trying to search for a file with "TODO" in the file, then symlink that file to a file called "softlink". And finally change the permissions? Is that correct?
– Ryan J. Yoder
1 hour ago