MAC X Useful Terminal Troubleshooting Commands
The following commands are run in Terminal.
CHECK HTTP CONFIG:
apachectl configtest -
REVEAL HIDDEN LIBRARY FOLDER
chflags nohidden ~/Library
LIST ALL OPEN FILES:
lsof
NETSTAT:
netstat -r
Show the routing tables. Use with -a to show protocol-cloned routes. When -s is also present,
show routing statistics instead. When -l is also present, netstat assumes more columns are there
and the maximum transmission unit (``mtu'') are also displayed.
netstat -s
Show per-protocol statistics. If this option is repeated, counters with a value of zero are sup-pressed. suppressed.
pressed.
netstat -an
The -a parameter lists all the computer's connections and listening ports, while the -n parameter displays addresses and port
numbers in numerical format. A typical (truncated) result from netstat -an looks like this:
RESTART WEB SERVER LION STEPS 10.7:
sudo diskutil repairPermissions /
sudo serveradmin command web:command=restoreFactorySettings
INSTALL ALL VERSIONS PHP:
http://php-osx.liip.ch/
FIND PHP.INI LOCATION:
php -i | grep php.ini
GET_WIDGETS_ON_HOME_SCREAN:
defaults write com.apple.dashboard devmode YES
INDEX SPOTLIGHT AFP SHARE:
Check if indexing is enabled on mounted volume
mdutil -s /Volumes/"volume name"
Enable Indexing if not enabled already
mdutil -i on /Volumes/"volume name"
Build index manually
mdimport -d 1 /Volumes/"volume name"
Check all spotlight volumes
for v in /Volumes/* ; do mdutil -s "${v}" ; done
FLUSH DNS:
dscacheutil -flushcache
OPEN PORTS:
sudo lsof -i -P | grep -i "listen"
ROOT USER:
sudo -s
FORCE EJECT CD:
drutil tray eject
FORCE EMPTY TRASH:
rm -rf ~/.Trash/*
DISABLE INTERNET WARNING DIALOGUE IN CONSOLE:
defaults write com.apple.LaunchServices LSQuarantine -bool NO
ENABLE:
defaults write com.apple.LaunchServices LSQuarantine -bool YES
CONFIGURE SNMP BASIC:
snmpconf -g basic_setup ---- START BASIC CONFIG
sudo cp snmpd.conf /usr/share/snmp ---- COPY CONFIG FILE TO PROPER PLACE
snmpwalk -c public localhost ---- TEST SNMP
FORCE RESTART COMPUTER:
shutdown - r now
DISABLE DASHBOARD:
defaults write com.apple.dashboard mcx-disabled -boolean YES
killall Dock
SHOW HIDDEN FILES:
defaults write com.apple.finder AppleShowAllFiles TRUE
defaults write com.apple.Finder AppleShowAllFiles YES
APACHE ERROR LOGS:
cat /var/log/apache2/error_log
SHOW_USERS_LOGGED_IN:
w
Comments