Chap 1 Flashcards

1
Q

Find out where your home directory is

A

echo $HOME

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

go to the root directory then back to home

A

cd /

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

What directory are you currently in

A

pwd

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

give an example of a relative and absolute path

A

/Users/carol/Music

../Music

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

Whats an easy way to write a very long folder path

A

drag the file from finder to the terminal

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

List all the files in a directory including hidden files.

A

ls -a

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

list in a single column

A

ls -1

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

list to show files and folders differentiated

A

ls -F

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

List with file sizes
Notice that the first line of output with the option is
always a sum of the size of all files in the specified
directory.

A

ls -s
The -s option indicates the size of each file, in units
of 512 bytes. Why 512 bytes? Well, that’s what the
original Unix filesystem used as its block size all those
years ago, and since then that’s just what the ls -s
command uses. If you really want to use -s but aren’t
interested in 512-byte blocks, you can set the
environment variable BLOCKSIZE to 1024 to make the
resultant listings use the more logical 1 kilobyte size:

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

See if a folder exists

A

ls -d Library

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

what does the . prove using the above command

A

it confirms that the current directory is indeed the

period (.) shorthand, as explained earlier.

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

List all files with more info

A

ls -l

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

List all files with more info and hidden files

A

ls -la

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

Get the file size of a file…..whet happens if you use the command on
a directory

A

du the_file_name

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

Now for the total directory size

A

du -s the_file_name

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

If you’d like separate totals for all directories and files, including
hidden ones, use a wildcard pattern that ignores the current (.) and parent
(..) directories, as discussed earlier in this chapter:

A

$ du -s * .[^.]*

17
Q

get the size of all .app files and sort by size

A

du -s /Applications/*.app | sort -rn

du -sh /Library/* //more human-readable output:

18
Q

Calculate available disk space

A

df -h; // divide-by-2 rule of the -h flag
df -H; // divide-by-10 rule
df -m: // -m flag to have df show you 1 MB blocks, which rounds

19
Q

list all the avaialble additional disks

A

ls /volumes

20
Q

show the long version of the above

A

ls -l /volumes