I have a C program that can lock 1 file. I need to lock multiple files so the solution here would be to have multiple instances of this program running but this also means having multiple terminals open (as many terminals open as there files to be locked) since once the program starts to run, that terminal is not usable.

I tried to use the following command to see if it works. I'll need to copy this command a couple of times into a script to achieve my end goal but the following command is giving me a weird error

konsole --workdir/ -e ./lock /vol4/commit/file_1

A new window opens with the following error message.

Warning: Could not find '/vol4/commit/lock /vol4/commit/file_1', starting '/bin/bash' instead. Please check your profile settings.

Can you please tell me what's wrong here ?


/vol4/commit/file_1 is an odd-looking file path, but anyway...

You don't need to run multiple terminals. You can run your command in the background, which will make the terminal available for further commands. Just append & to the end of the command line. Eg,

./lock /vol4/commit/file_1 &

From the Bash man page


A list is a sequence of one or more pipelines separated by one of the operators ;, &, &&, or ││, and optionally terminated by one of ;, &, or <newline>.


If a command is terminated by the control operator &, the shell executes the command in the background in a subshell. The shell does not wait for the command to finish, and the return status is 0.

Also see the information given in the Job Control section of the Bash man page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.