Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > List of useful Mac OS X terminal commands

List of useful Mac OS X terminal commands
Thread Tools
herbsman
Dedicated MacNNer
Join Date: Aug 2003
Status: Offline
Reply With Quote
Jan 31, 2010, 02:28 AM
 
I'd like to start a thread about useful Mac OS X terminal commands:

Installing available software updates:
sudo softwareupdate -ia

Repairing disk permissions:
sudo diskutil repairPermissions /

Toggling airport off and on:
sudo ifconfig en1 down (off)
sudo ifconfig en1 up (on)
     
Simon
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Jan 31, 2010, 03:41 AM
 
Checking battery status:
ioreg -l | grep -i LegacyBatteryInfo
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Jan 31, 2010, 01:28 PM
 
- lsof
- top, ps, kill
- cat, grep, find, awk, more, sort, etc.
- tail -f /path/to/logfile
- ssh, rsync, scp
- screen
- memtest (this is not included with OS X)
- ping, host, dig, traceroute, etc.
- ifconfig
- du
- port (Macports command)
- curl, wget (the latter is not included with OS X)
- ttf2eot, fondu, fontforge (likewise)
- wine (also likewise)
     
reader50
Administrator
Join Date: Jun 2000
Location: California
Status: Offline
Reply With Quote
Jan 31, 2010, 03:32 PM
 
Place a Trash folder on your desktop. Works for files on same hard drive, but doesn't do the Eject function. No delay on use, no CPU load.
ln -s /Users/yourAccountName/.Trash Desktop/Trash
     
Hal Itosis
Grizzled Veteran
Join Date: Mar 2004
Status: Offline
Reply With Quote
Jan 31, 2010, 05:36 PM
 
Originally Posted by herbsman View Post
sudo diskutil repairPermissions /
Less popular than most.

No (jest joshing), i only wanted to mention that sudo is not needed for that one.

--

I feel all users should get real comfortable with list ( ls ), and use it for troubleshooting questions. E.g.,

ls -alOe /path/to/the/problem/file/or/folder

A good listing is often better than words (and pictures).

Besson already mentioned find. (Probably 90% of my most shell scripts have a "find" in there somewhere).

Please learn sed and eschew cut (i really dislike cut).

Thanks. (now back i go to the endless task of learning perl. )

EDIT: forgot to add something useful. Maybe,
list all 3rd-party prefPanes... and extensions:

system_profiler SPPrefPaneDataType |
grep -A2 -B3 3rd |sed '/3rd/d;/./!d'

kextstat |grep -v com.apple
( Last edited by Hal Itosis; Jan 31, 2010 at 05:51 PM. )
-HI-
     
herbsman  (op)
Dedicated MacNNer
Join Date: Aug 2003
Status: Offline
Reply With Quote
Feb 8, 2010, 12:19 AM
 
How does one toggle 'remote access /ssh' via the terminal?

If it's possible, I presume the command would usable and quite useful when in single-user mode during times of need
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Feb 8, 2010, 12:40 AM
 
Networking access is not supported in single-user mode, as single user mode boots you into a lower level run level.

I don't know of a way to toggle SSH access via the Terminal, although you might want to look for a launchd file.
     
Simon
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Feb 8, 2010, 03:25 AM
 
This might come in handy for some. Turning VNC screen sharing on and off via the CLI.

to turn on:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvnclegacy -vnclegacy yes
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvncpw -vncpw PASSWD

where PASSWD is a password you chose for VNC screen sharing.


to turn off:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvnclegacy -vnclegacy no
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 08:58 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,