Topic 4 - Unix Files and Directories Flashcards
What is a computer file?
A container for a sequence of bytes
What are the 4 types of files?
1) Regular normal file
2) Directory
3) Link
4) Device (Unix treats a device like a file
Does the shell remember the current directory for you or do you have to remember the current directory on your own.
The shell remembers the current directory for you
What is the cmd for determining the current directory?
pwd (print working directory)
cmd for changing directories?
cd
The cmd “ls” does what?
listing the contents of a directory
How is the Unix filesystem organized?
As un upside-down tree; top of the filesystem is the root
Whats the symbol for the root directory?
/
How do you change from the current directory to the root directory?
cd /
Examples of file names in unix: a.out( data@ readme.txt tmp/ Are the letters *,@, and / part of the file name?
No, just indicators to give more information about the file
A typical Unix file system spans _____ disks?
Many
As a user, do you need to know which physical disk is used to store your things?
No
What is the cmd for reporting on all mounted file system?
df.
Definition of Absolute Pathnames?
- start from the root directory ie. /
- string together all directory names that are in your path to the file
- separate each directory name by a single slash
What does ~ mean?
Refers to the $HOME directory
What does “cd” with no arguments do?
Changes the working directory to your home directory
Define Relative Pathnames
Specifying pathnames relative to the current working directory using . and ..
what does “ .. “ mean?
Start from parent directory
What does “ . “ mean?
Start from the current directory
How do you create a new directory?
mkdir
How do you remove a directory? (as long as it exists and is EMPTY)
rmdir
How do you move a file or directory?
mv
How do you copy a file from one directory to another?
cp [filename]
How do you copy a directory?
Use a recursive copy: “cp -r” to copy the directory
Pushd does what?
changes the current working directory, and also remembers the previous one by pushing it on to ta stack
Popd does what?
change the current working directory back to the last directory placed on the stack by pushd
dirs does what?
Keeps track of what you have so far in the stack