Chap 1 Flashcards
Find out where your home directory is
echo $HOME
go to the root directory then back to home
cd /
What directory are you currently in
pwd
give an example of a relative and absolute path
/Users/carol/Music
../Music
Whats an easy way to write a very long folder path
drag the file from finder to the terminal
List all the files in a directory including hidden files.
ls -a
list in a single column
ls -1
list to show files and folders differentiated
ls -F
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.
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:
See if a folder exists
ls -d Library
what does the . prove using the above command
it confirms that the current directory is indeed the
period (.) shorthand, as explained earlier.
List all files with more info
ls -l
List all files with more info and hidden files
ls -la
Get the file size of a file…..whet happens if you use the command on
a directory
du the_file_name
Now for the total directory size
du -s the_file_name