My Terminal Note
My Terminal Note

TOP command
% top
This shows a real-time view of running processes on Mac. Also, if you click “q”, it would be ended.
Update your software
softwareupdate -i -a
You can use the Terminal to check for new software updates as well as download and install any that are available.
Check the system Information
system_profiler SPSoftwareDataType SPHardwareDataType
Change your Mac’s sleep settings
There are two ways to change your Mac’s sleep settings: in the System Preferences and using the Terminal, which is faster.
If you want your Mac to stay “awake” for a specific length of time, you can use the command:
caffeinate -t
Example of above
caffeinate -t 3600
You can also use other flags besides -t. There’s -i to prevent your Mac from going idle, -s to keep the whole system awake, and -d to keep your display from going into sleep mode.
Increase Dock spacing
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock
You can use the Terminal to increase the space between apps on your dock to make it look a little neater.
Change screenshot name
defaults write com.apple.screencapture name “New Screen Shot Name”
Replace the text New Screen Shot Name with your preferred name, of course, still enclosed in quotes. Finish it with command:
killall SystemUIServer
Change screenshot format
defaults write com.apple.screencapture type <format>
// Example (You can choose between JPG, GIF, TIFF and RAW)
defaults write com. apple. screencapture type JPG
At default, your screenshots will be in PNG format, which means that every screen capture you do on your Mac will be a PNG image unless you change it.
Compress and password-protect a folder
// to compress a folder and limit its access
// First Step: change the directory to your folder’s location (This is the example if your folder is in the desktop
cd ~/Desktop/
// Second Step: Type these
zip -er
Shut down or restart your Mac
// in order to shut down
sudo shutdown -h now
// in order to restart
sudo shutdown -r now
Wipe your download history
// View your downloads history
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'
// to delete all of it
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'
Make your Mac talk
say “text”
// For Example
say “Hello, my queen”
Check your info about network interface
// Mac & Linux
ifconfig
// Windows
ipconfig/all
How to ream a response
Variable | Screen Output | Description |
IP address | inet 10.0.0.112 | Displays the IPv4 or IPv6 address that is assigned to the interface. |
MAC address | ether 8:0:20:b9:4c:54 | Shows the interface’s Ethernet layer address. Mac Address Vendor Look Up |
Show all of the devices connected to your network
arp -a
Show the trace to the path that an IP packet takes to its destination
// On mac and Linux
traceroute
// For Windows
tracert
// Example
traceroute www.harvard.edu
***は何? (コマンド打ったらよく見かける)
1つ目の記事: You might notice one or more lines of your traceroute output is listed only with an asterisk (*). This means that the program did not receive any response from the router at that hop. Some organizations choose to block or discard the type of packets that traceroute relies on, either by blocking them with a firewall or configuring routers to discard the packets instead of replying. Traceroute traffic is also considered low-priority; a busy router may process standard data packets rather than reply to your traceroute request.
2つ目の記事: If the traceroute command completes successfully and you see these stars, most likely the device that was hit was not configured to reply to ICMP/UDP traffic. This result does not mean that the traffic wasn’t passed. The second possibility is that the packets were dropped due to an issue on the network.
Show the Ping Test Result
ping {IP Address}
Useful Articles