passwd - program located somewhere in shin that changes a password of a user. When in super user does not need a prior password
scripts: #!/bin/sh -
To start a script you need to use a shebang, which lets a computer know it is a script. The next words will specify the type of shell it is. Sh is one type Bash is the other. The both yield about the seam results. To execute a shell script, do ./(script name) Make sure to add sh at the end of a script.
shell script: #!/bin/bash
alias
drag and drop terminal, open - drag and drop is a useful teacher on the mac gui that allows you to drag a file to terminal and it will show the pathway to that file. Useful for saving time.
open -a safari, chess
permissions: chmod, ls -la, 421 rule 1-2-4 = rwx
4+2+1=7
Permissions allow someone to read,write, or execute. X has value of four. Write two. Read one. 777 gives full read/write permissions to all users. 700 makes private (rwx for you, nothing for anyone else.)
chmod a+x: changes permissions of a file to let you execute. You need to to make this to run your sciprt
chown- changes and items owner. Chown bob file1 will change owner of file1 to bob.
Chown bob:accounting file1 changes bob to owner and group to accounting. Use sudo before.
su vs. sudo: su is literally the root user. Using it will keep the session superuser. it is a hidden account to do anything. sudo is make superuser for command.
defaults commands - defaults (name of long script_ changes plist files to do all sorts of different. It can add, modify, or remove a preference from plist.
some examples:
defaults write com.apple.mail PreferPlainText -bool TRUE
defaults write com.apple.dashboard devmode YES; killall Dock
defaults write com.apple.dashboard mcx-disabled -boolean
YES; killall Dock
defaults write -g NSNavPanelExpandedStateForSaveMode -bool TRUE
sudo softwareupdate -i -a: perform a soft here update. -i -a are to flags that say to install everything that is found
grep, pipes: grep command sifts through log files looking for specific strings. grep error in /var/log/sstem.log will look through the log to find everything. How to use grep with something else: ps -ax | grep ssh
tar, tarballs: tar is a ape archive. tar -xf will decompress a thing.
textutil -convert filename1.ex -output filename2.ext will change a file
textutil -convert ext1 file1.ext2 will convert ext 2 to ext1
curl URL > filename.html: use it to save a local copy of a webpage
Here is for public ip -
curl -s http://www.showmyip.com/simple/; echo
here is for nearby wifi
/System/Library/PrivateFrameworks/Apple80211.framework/
Versions/A/Resources/airport -s
Lsof -i shows processes that are connecting to the intent
ping shows if a server is running
host shows the ip address of a web server you are connected to.
ex: host www.facebook.com
whois shows info on a person that owns a domain name.
whois tidbits.com
SCP- secure copy. how to use scp -r user@host:directory/SourceFolder TargetFolder
Comments