Make sure you quit and restart the apps to see the changes and if you want to reverse anything, simply substitute. (for example if you're going to sell your Mac), then execute the following command: diskutil secureErase freespace 3 /Volumes/name-of-drive.
Terminal User Guide
To restart a computer now or at a specific time using Terminal, you can use the shutdown
command or the systemsetup
command. The following examples show some ways to use these commands, but for complete information about them, see the shutdown command man page and the systemsetup command man page.
Tip: It’s easier to restart your Mac by choosing Apple menu > Restart, or shut it down by choosing Apple menu > Shut Down. See Log out, sleep, restart, or shut down your Mac.
Restart the local computer
In the Terminal app on your Mac, enter the following command:
Restart a remote computer immediately
In the Terminal app on your Mac, enter the following commands:
Replace admin with the short name of a user account on the remote computer.
Replace computer with the IP address or host name of the remote computer.
Restart a remote computer at a specific time
In the Terminal app on your Mac, enter the following commands:
Replace admin with the short name of a user account on the remote computer.
Replace computer with the IP address or host name of the remote computer.
Replace hhmm with the hour and minute you want the remote computer to restart.
Restart automatically after power failure
In the Terminal app on your Mac, enter the following command:
% sudo systemsetup -setwaitforstartupafterpowerfailure seconds
Replace seconds with the number of seconds before the computer starts after a power failure. This value must be 0 (zero) or a multiple of 30.
Note: You can also use Energy Saver preferences to set a Mac to restart automatically after a power failure.
-task bar disappeared?
-Screen resolution is off and can't see your task bar ?
-RDP (Remote Desktop Protocol) and no restart/shutdown options ?
- just bored of doing the routine restart (start menu-->shutdown ->restart)?
-or maybe you just want to look cool around people ;-}?
or just for fun and want to prank others?
so how to restart using the Dos command or CMD?
3 Steps total
Step 1: Open CMD
to open CMD :
1. on your keyboard: hold windows logo key down and press 'R'
this will open Run
2. type: CMD and hit enter
this will open the Dos Command
you can open CMD in many ways but I prefer this way in case your screen resolution is off and you like to see what you're doing.
Step 2: Command Line to restart
Mac Restart App From Command Line
to restart type the following (noting the spaces):
shutdown /r /t 0
NOTE: there's a 1 space before each forward slash '/' and 1 space before x seconds (between t & # of seconds you specify).
Explanation:
/r to request restart
/t 0 sets the time to 0 seconds until it restarts.
you can choose from /t 0 for zero seconds up to /t 1,440,000 (400 hours) [corrected]
Examples:
shutdown /r /t 60 =1 minute until the system restarts
shutdown /r /t 180 = 3 minutes until the system restarts
Step 3: Good to know: Command Line to shutdown
to Shutdown, type the following (noting the spaces):
shutdown /s /t 0
Command Prompt For Mac
NOTE: there's a 1 space before each forward slash '/' and 1 space before x seconds (between t & # of seconds you specify).
Explanation:
/s to request shutdown
/t 0 sets the time to 0 seconds until it restarts.
you can choose from /t 0 for zero seconds up to /t 1,440,000 (400 hours) [corrected]
Examples:
shutdown /s /t 60 =1 minute until the system shuts down
shutdown /s /t 180 = 3 minutes until the system shuts down
Mac Terminal Commands
32 Comments
- TabascoCerbere Dec 6, 2017 at 08:57pm
Good write-up, but you left out my most common scenario for using this on the command line: When I'm RDP'd into a machine, and the restart (and shut down) option(s) aren't available through the start menu.
- AnaheimCYBW1Z Dec 6, 2017 at 09:01pm
@Cebere very true. I actually bumped into that issue few weeks ago.... I'll add it thanks!
- Thai PepperFrostyck Dec 6, 2017 at 09:22pm
Plus if you want to be even faster, just press the start button and type CMD.
No need to go through the run command.
Shaves off the super massive time of one single keystroke lol. - Cayennerandallader Dec 6, 2017 at 09:59pm
I created a Restart.bat file for the users of some VM's that RDP into for the express purpose of restarting/shutdown/cancel of said VM's without waiting for me. Been doing this for years.
Useful and easy for them.
Here's my code:
REM Restart/Shutdown/Cancel batch file for times where you may not have access to those options on the start menu
REM Remove the rem statements on the :Restart, :Shutdown and :Cancel subroutines for this to workcls
@ echo offchoice /s RSC /n /t 30 /d c /m '[R]estart in 30 sec, [S]hutdown in 30 sec or [C]ancel?'
if errorlevel 1 if not errorlevel 2 goto Restart
if errorlevel 2 if not errorlevel 3 goto Shutdown
if errorlevel 3 goto Cancel:Restart
rem shutdown /r /t 30
echo Restarting in 30 seconds...
echo Rerun batch file to abort restart.
goto End:Shutdown
rem shutdown /s /t 30
echo Shutdown commencing in 30 seconds...
echo Rerun batch file to abort shutdown.
goto End:Cancel
rem shutdown /a
echo Aborting restart/shutdown.:End
- HabaneroGorfmaster1 Dec 6, 2017 at 10:57pm
On my friend's computer, Here is how I got to wean him off of using Internet Explorer. I created a batch file that had that shutdown command and changed the icon to IE. So every time he clicked on the Internet Explorer Icon, it turned off his computer. Made it more secure too.
- Jalapenoferrit2uk Dec 7, 2017 at 01:07pm
Shutdown -i to restart someone elses computer if you're domain admin or have the rights that is and know the PC name or IP of who to shut down/reboot
- Cayennejayson1775 Dec 7, 2017 at 07:15pm
Powershell much much gooder.
powershell in run
rest tab , that will display restart-computer, hit enter.
- CayenneGreg2078 Dec 7, 2017 at 07:28pm
There's an 'Uh Oh' article somewhere by me...please don't use -t 0
Give yourself a little time, so when you realize you accidentally ran that on the wrong console, you have some time to shutdown -a(-a is for abort)
- TabascoLanceHarmstrong Dec 7, 2017 at 07:31pm
This is quite basic, but I'll bite.
Why are you running command prompt from win+r or start menu? Both of those things will accept shutdown commands directly. In fact, you can run a shutdown command from any explorer window, as well.
Win key - type shutdown . Done.
- Cayennedavecork Dec 7, 2017 at 07:57pm
Another little tidbit... I have this set up in task scheduler. If I want to schedule a reboot, I just change the trigger (time). This allows me to reboot in the middle of the night, while I'm soundly sleeping.
- JalapenoRedW1dow Dec 7, 2017 at 08:34pm
you can also add a comment to a popup with -c '. I used to create a shortcut with this command in HS and make it look like IE.
shutdown -s -t 120 -c 'All files will be deleted upon shutdown!'
It was all for fun and games.
ALSO, use shutdown -a to abort the scheduled shutdown!
- SerranoLendys Dec 7, 2017 at 08:38pm
Also, to log out of the local machine:
shutdown /l
(that's a lowercase L)Also also, the /i parameter VeriLan mentioned does shutdown/restart a remote machine, but it pulls up a GUI. If you wanna stay strictly command line, add:
/m %hostname%
Unfortunately, that doesn't work with the logoff parameter... - Tabascodwren Dec 7, 2017 at 09:13pm
Good, but in step 3 you copied and pasted the restart commands. Your /r should be /s in those last two lines.
- SerranoSean4178 Dec 7, 2017 at 09:20pm
/f at the end will force it if there are applications or OS hangs
- Thai PepperMR.Burnz Dec 7, 2017 at 09:25pm
Very cool. I don't really run into the scenario to use this but I will try this. Thank you.
Restart App From Mac Command Line Download
- 1
- 2
- 3