Command Line
Revised: 2008-11-05 jamesCommand Line
Date: Friday, November 7th, 2008
Time: 2:00 - 3:30 pm
Where: Marriott Library, Multimedia Center, Classroom 1705A
It is assumed you know:
- Basic terminal navigation and usage
Class will cover:
- 10.5 Screen Sharing
- Logging in w/o GUI (and how to disable it)
- nvram security
- SSH
- X11
- Absolutely essential admin commands such as fs_usage, vmstat, system_profiler, asr, kill, plutil, bless, defaults, etc
Class Notes from February 2008
10.5 screen sharing
---
>console
>restart
>power
/Library/Preferences/com.apple.loginwindow.plist
<key>DisableConsoleAccess</key>
<true/>
---
nvram security-mode=none
nvram boot-args=
nvram boot-args=-s
nvram boot-args=-v
---
/etc/sshd_config
Protocol 2
...
AllowUsers mac
10.5 built-in
service ssh start
service ssh stop
What file turns on ssh?
/etc/ssh_host_dsa_key
/etc/ssh_host_dsa_key.pub
/etc/ssh_host_key
/etc/ssh_host_key.pub
/etc/ssh_host_rsa_key
/etc/ssh_host_rsa_key.pub
/System/Library/LaunchDaemons/ssh.plist
---
fs_usage | egrep "/.*"
---
10.5 X11
Sycns with Xorg 7.2
Installed by default
A "work in progress"
Biggest user-visible change in Leopard X11 is a new launch-on-demand support. Type *any* x11 command in Terminal.app and it will open in X11.
http://homepage.mac.com/sao1/X11/index.html
http://forums.macosxhints.com/showthread.php?t=80171
---
system_profiler
---
kill
killall
kill -9 (killall -9)
kill -USR1
kill -USR1 DirectoryServices
---
Plist files
Dictionary
Array
Integer
String
etc
plutil -convert xml1 ...
plutil -convert binary1 ...
---
To not create .DS_Store
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
cp ~/Library/Prefrences/com.apple.desktopservices.plist /Library/Prefrences/
sudo chmod 755 /Library/Prefrences/com.apple.desktopservices.plist
---
Universal Access
GUI AppleScripting
Funky problems are amusing: strange random clicking, wacked out or zoomed display, keyboard quits working, etc.
---
echo "source /usr/share/tcsh/examples/rc" > ~/.tcshrc
echo "source /usr/share/tcsh/examples/login" > ~/.login
echo "source /usr/share/tcsh/examples/logout" > ~/.logout
---
ASR images
Creating:
sudo -s
hdiutil create -srcfolder "/Volumes/some volume/" -format SPARSE "sparse_image"
hdiutil convert "sparse_image.sparseimage" -format UDZO -o "compressed_image"
asr -imagescan -nostream "compressed_image.dmg"
Using:
sudo asr restore --source compressed_image.dmg --target /Volumes/10.5.0 --erase
---
http://www.bombich.com/mactips/openfirmware.html
bless -folder /Volumes/diskname/System/Library/CoreServices -bootinfo /usr/standalone/ppc/bootx.bootinfo -label "diskname"
---
http://www.bombich.com/mactips/commands.html
softwareupdate
prints list of needed software
setenv COMMAND_LINE_INSTALL 1
softwareupdate <name>
---
#!/usr/bin/perl
sub reload_preferences_plist {
my @scutil = `scutil <<- end_scutil 2> /dev/null
open
show Setup:/
close
end_scutil`;
my @matches = map { m/UserDefinedName : (.*)/ } @scutil;
if(@matches == 1) {
`scselect $matches[0]`;
}
}