I can't paste the long command into the terminal.
There is a ls command which takes alot of argumnets and i'm trying to insert in into the terminal by copying.
But it runs every single line.
So i get error.
What can i do ?
I can't paste the long command into the terminal.
There is a ls command which takes alot of argumnets and i'm trying to insert in into the terminal by copying.
But it runs every single line.
So i get error.
What can i do ?
It sounds like it's multiple commands, or one that has —for some reason or other— been split over multiple lines. If you could show us, that would go some distance to let is know which it is in this case.
That's not to say that there aren't cases where a command really is too long, it's just really rare in practice, certainly when copying and pasting! If you are hitting this wall, look at xargs
per Eduard's answer.
Formatting on the internet isn't always perfect. Some websites (and authors) use poor tags for code and that can mean that some things get split onto multiple lines, breaking them. A simple example is running ls on two directories getting truncated:
ls a_really_long_directory_name
another_really_long_directory_name
The simple answer here is just removing that newline:
ls a_really_long_directory_name another_really_long_directory_name
But you can also escape the newline with a backslash as the last character on the line:
ls a_really_long_directory_name \
another_really_long_directory_name
If "the command" actually looks like:
ls a_really_long_directory_name
ls another_really_long_directory_name
That's two commands. When you paste them in each newline character is going to force that line to run. That's how most shells work in Ubuntu. If you want to bunch them together you can paste them into a file (let's call it myscript
) and then tell bash to run those commands:
bash myscript
You don't have to mess around with crunchbangs and execute permissions, you just tell bash which file to open and run. You can do those things if you want to but they aren't necessary here.
The length limit is rather long, you can check it with:
xargs --show-limits
(see What is the maximum length of command line arguments in gnome-terminal?)
So there are probably new lines between the comments. You can check it by first pasting it into gedit and make sure it has only one line, then you can paste it in the terminal use Ctrl+Shift+V