# Mac OS Terminal Cheat Sheet

<span style="white-space: pre-wrap;">Option+Arrow Key will go through command items. </span>

Arrow up will select the previous command (and then down will take you back)

### Randos

Select directory

```
cd
```

Check reboot / restart history

```shell
last reboot
```

Check uptime

```
uptime
```

### Changing the File Date

<span style="white-space: pre-wrap;">This is a sneaky way to manually change the file creation date of a file to make something appear that it comes from the past or the future. Good for faking render dates / times. I do not advise this but it is a thing you can do. </span>

“I’ve never done this because that would be unethical” - Cam Vokey, attorney at law

```
touch -mt 202109160951
```

replace date with desired date time YYYYMMDDHHMM and then drag in your files to the terminal window.

### Setting Up A System Scheduler

It used to be you could do this in System Settings, but now it has to be done in terminal

<span style="white-space: pre-wrap;">You can only have ONE event. You can't schedule multiple events. </span>

Get current schedule

```
pmset -g sched
```

Reset active schedule

```
sudo pmset repeat cancel
```

Set Restart every day at 4am

```
sudo pmset repeat restart MTWRFSU 04:00:00
```

### Multiple Calculators

<span style="white-space: pre-wrap;">Up until 2018ish, Mac OS had something called a “dashboard” which was a system-wide hotkey that would overlay above all the apps. Within that dashboard were “widgets” - this was a good place to have things like timecode calculators, multiple regular calculators, unit conversion. Alas, it was removed from Apple’s development and for those who got used to having “as many damn calculators as I want”, it was a major loss. </span>

<span style="white-space: pre-wrap;">To fix this major gap in lifestyle, I consulted the internet, and the solve was to create a .command file (this is a terminal executable file), that launches a second calculator (or third, or fourth). I call this “morecalc” - and I use the hotkey for spotlight-search to launch it. I press command+spacebar, type “morecalc”, and it will launch another calculator. </span>

How to do this yourself:

1. Open up text edit
2. Make it plain text (command-shift-T is a good to know hotkey)
3. <span style="white-space: pre-wrap;">Copy and paste this text: </span>`<span class="editor-theme-code">open -na Calculator</span>`
4. Save it as “morecalc” or whatever unique file name that will easily come up in spotlight.
5. Quit text edit
6. <span style="white-space: pre-wrap;">In finder rename this saved file to “yourname.command” </span>
7. <span style="white-space: pre-wrap;">Now you have however many calculators you want, any damn time you want them. </span>