- If you are using the command line to kill a process, you can use the command line to find the process info also. Two commands that come to mind are top and ps -ax. Top will give you a list of processes with the PID and the program name also sorted by CPU usage.
- After the prompt is where you will be typing commands. Terminal: This is the actual interface to the console. The program we use to interact with the console is actually a “terminal emulator”, providing us the experience of typing into an old school terminal from the convenience of our modern graphical operating system. Running a Command.
- I need a terminal command to open a program, wait about 10 seconds, and then close it, and keep doing that on a loop. Is there any way to do that?
MichaelNash wrote:
Linux user here moving to Mac, and I've got some (probably basic) questions.
Welcome aboard! and Fire away!
I'm trying to write a backup script. I want to mount a drive using sshfs, use rsync to backup the files, and then unmount the drive.
Still thinking Linux I see. Why not use Time Machine?
That I can. What I am doing is copying the backup files to a directory that is used with the Dropbox service (online backup service); a program for this opens at start up and monitors the backup folder, then copies files to an online service when they arrive in the local directory.
The trouble is rsync confuses it
In what way? On a Mac, you shouldn't have to resort to workarounds. Ask, at a high level, what you are really trying to accomplish. I assume at this point you are trying to use an online backup server instead of Time Machine. Fair enough. But rsync too? Now I'm a bit worried that you are falling into a workaround hole looking for the answer to a question you shouldn't have even needed to ask.
- I have to close the Dropbox program, perform my backup, then restart the program. Now, I know how to open a program:
open -a 'Dropbox'
There are other ways. Does this have to be run from the Terminal? I'm a big Terminal fan, but it seems like a scripted folder might be a better answer.
but how do I use the terminal to close it? I don't want it to be killed, I just want to shut the program down normally.
kill (without -9) should work. You could do too.
With this command, the 'top' program will run and show you the system's process list, but when you quit 'top,' the shell will then exit and the window will immediately close. However, if you change this behavior you can run commands and scripts in ways that will close the window when done. To do this, go to the Terminal's preferences, then to the Settings section,. Spotlight displays a list of matches for the word 'terminal' including the program. Click the entry for Terminal to open it. Closing Terminal. To quit the Terminal program, right-click the Terminal icon in the Dock and click on Quit. You can also click the Terminal pull-down menu and select the Quit Terminal entry or press the Command - Q keyboard shortcut.
Active5 years, 2 months ago
![Terminal Command For Mac To Close Program Terminal Command For Mac To Close Program](/uploads/1/2/6/0/126071286/829396488.jpg)
When I want to close a window I type
exit
:Then cmd + w to close the window.
Is there a way to do it with a little script like if I type
Thomas AyoubThomas Ayoubquit
it exit the session then close the window ?1,50844 gold badges1313 silver badges3636 bronze badges
2 Answers
- Open Terminal.
- Go to Terminal → Preferences….
- Select the Settings tab, then your profile, and choose the Shell tab.
- Set When the shell exits to Close if the shell exited cleanly.
145k2525 gold badges229229 silver badges340340 bronze badges
fsimkovicfsimkovic
You could also simply quit Terminal by using Cmd+Q
HugoHugo