Basic Commands Flashcards

1
Q

How to display Disk Utility attached disks?

A

diskutier list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to restart the Finder?

A

killall Finder

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Command to make Mac speak?

A

say “Hi, Terminal says hello.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Keep Mac from falling asleep.

A

caffeinated

-t (number of seconds)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Print CML history to screen?

A

history

-c (will clear history list)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Set root password.

A

sudo passwd root

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Log-in as super user or root?

A

su or sudo -s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Change directory

A

cd /applications

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Change to another volume

A

cd /volumes/”Mac OS X”

spaces need quotes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Remove or delete a file

A

rm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Remove a file in a different directory?

A

rm

example: re /Applications/Candybar.app

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Remove a directory or folder.

A

rm -d

Example: rm -d delete_me

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to copy a file?

A

cp

Example: cp something.txt somethingeles.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How to move a file?

A

mv

Example: mv something.txt /Applications

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Find a file

A

locate

Example: locate text.kext

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Find a binary file

A

whereis

Example: whereis rm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Create a folder

A

mkdir
Example: mkdir directory
(it will make directory in current folder)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Move a folder

A

mv

Example: mv folder /Applications

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Repair Permissions for a folder

A

chmod -R 755
chmod root:wheel
Examples: chmod -R 755 /System/Library/Extensions
(repair the Extensions folder)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Repair Disk Permissions without DiskUtility

A

diskutil repairPermissions /

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

List files in a directory

A

ls

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Print Working Directory

A

pwd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Get a list of every process running on computer?

A

ps -ax

“process status” dumps all processes with ID #

24
Q

Check if a process is running?

A

ps -ax | grep

(this combines grep with the process status command”

25
Forcibly end a process
kill
26
Find current user
whoami
27
Get current location or hostname?
hostname
28
Navigate to home directory
cd ~ cd ~username cd /Users/username
29
How do you auto complete in CLI
press TAB
30
Check powerbook standby time
pmset -g (standby delay will be 10800 seconds by default) chang it using: sudo pmset -a standbydelay
31
Open file in Quick Look
qlmanage -p
32
Clear the terminal
clear
33
How do you type a file name with a space in it
``` escape the space with \ Example: cd /Volumes/Macintosh\ HD/ or cd "/Volumes/Macintosh HD/" ```
34
List directory with list format
ls -l
35
List files in a directory with hidden files
ls -a | combine with -l by typing ls -la to display both list format and hidden files
36
Command to copy large amounts of data
ditto -V (-V verbose prints one line to terminal for each file) Example: ditto -V /old/work/ /new/work/
37
Change Screenshot file format
defaults write com.apple.screencapture type PDF run killall SystemUIServer to see changes to revert defaults write com.apple.screencapture type png
38
Change Screenshot location
$ defaults write com.apple.screencapture location /drag/location/here then:: killall SystemUIServer
39
Run a system stress test
yes | type Ctrl-C to stop
40
View file system usage
``` sudo fs_usage (type Ctrl-C to stop) ```
41
View contents of any files
cat /path/to/file
42
Rebuild Spotlight index for a drive.
sudo mdutil -E /Volumes/DriveName | this will delete the index and auto-rebuild
43
Check the uptime of you mac
uptime
44
Open file in any application
open -a /Application/AppName.app /path/to/file.txt
45
List and install OS X software updates
sudo softwareupdate -l (lists software updates) sudo softwareupdate -ia
46
Display a custom message at Login on multi user mac
sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "Your Message!" (to clear the message) sudo defaults delete /Library/Preferences/com.apple.loginwindow LoginwindowText
47
Run same command again
!! (if you forget sudo after typing a command) sudo !! (will run same command with sudo in front)
48
Download a file without the browser
curl -0 http://urltodownload.com/dmg.dmg
49
Shutdown mac without delay
sudo shutdown -h now sudo shutdown -r now (add a time delay) sudo shutdown -r +60
50
Create a file of any size.
mkfile 1g test.abc | bytes (b) kilobytes (k) megabytes (m) gigabytes (g)
51
Continually monitor a file (system log, etc.)
tail -f /var/log/system.log | terminal will constantly watch file as lines are added it will print to screen
52
Get your IP address
ipconfig getifaddr en0 | wired interface is en0 and wireless is en1
53
Get your External IP address
curl ipecho.net/plain; echo
54
How to test network connection
ping -c 10 www.apple.com
55
Have the Mac read a text file
say -f
56
Restore a disk image to External Drive
sudo asr -restore -noverify -source /path/to/diskimage/dmg -target /Volumes/VolumeToRestoreTo
57
View all active processes
top