Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
If you have your terminal started and you type in "medit" and hit Enter, medit will start and you won't be able to use that terminal until you close medit. But if you type in "medit &" you'll be able to use terminal without closing medit. So you can use one terminal instance to start any amount of apps you like with "&".
A single ampersand at the end of a command forks the process into the background, so the shell can continue onto the next operation without having to wait for it to finish. The output you get is the process number, as reported by the shell's job control feature. It's rather pointless to use it with commands that terminate instantly, though, like echo.
additionally, '&&' will run one command after another. example: the two commands, 'apt-get update', and 'apt-get dist-upgrade' are two separate commands but can be linked with the '&&' by:
BTW, I don't know if anybody noticed this, but testing things as root is one road to ruin, new Linux user or not. To minimize SNAFUs best use your unprivileged user account for that and only switch to root if required.
additionally, '&&' will run one command after another. example: the two commands, 'apt-get update', and 'apt-get dist-upgrade' are two separate commands but can be linked with the '&&' by:
Code:
apt-get update && apt-get dist-upgrade
Actually, when && is used, the second command will only be run if the first command succeeds. This is because && is the logical AND operator. The way bash evaluates logical expressions, a logical AND will always fail if any of the subexpressions is FALSE. Therefore, if the first command in the string fails, the second will not be executed as the expression has already failed. The opposite behavior is given by || (logical OR), which will execute commands until any one of them succeeds. If you want all commands in a string to be run regardless of the success or failure of any individual command, they should be separated by semicolons ( ; ).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.