Chapter 4 Managing Files Flashcards
A few characters have special meaning and should never be used in file names. What are they? pg 179
*,? / "
What is a wild card? pg 180
A wildcard is a symbol or set of symbols that stand in for other characters.
What are 3 common classes of wildcards in Linux?
- Star, ? Question Mark, Square or bracketed
What does the cp command do?
copies a file
What are the 3 operating modes of cpio? pg 191
Copy-Out, Copy-In,Copy Pass
What does the mkdir command do? ?pg 198
Creates a Directory
What does the rmdir command do? pg 198
Destroys the directory
which command will delete an entire directory tree? pg 198
-p or –parents Example(rmdir -p one/two/three)
What is the sticky bit? pg 205
its used to protect files from being deleted by those who don’t own the files.
what are the prerequisites of using Linux’s disk quota system?
Linux’s disk quota system requires support in the Linux kernel for the file system on which quotas are to be used. you must also run the quotation command typically from a start up script to enable this feature.
Describe linux file ownership system?
Every file has an owner and a group, identified by a number. File permissions can be assigned independently to the files owner,the files’s group, and to all other users.
True or False pg 190 True
the xz compression tool has gained so much popularity, the linux kernel is now compressed with it.
Linux-native file systems maintain three time stamps for every file: what are the three?
Last File Modification time,Last inode change time,Last access time
/root
root is the user name or account that by default has access to all commands and files on a Linux or other Unix-like operating system. It is also referred to as the root account, root user and the superuser.
summarize Linux’s directory manipulation commands?
the mkdir command creates a new directory. and rmdir deletes a directory. You can also use many file manipulation commands such as mv and rm
if you want to search a directory and perhaps some limited number of sub directories what can you use?
-maxdepth
on Page 221 there are 5 directories that should not be on their own partitions. Name them?
/bin /dev /etc /lib /sbin
A superuser can turn quotas on at anytime by using what command? pg 214
quotaon
A superuser can turn quotas off at anytime by using what command? pg 214
quotaoff
What is symbolic mode?
its a set of codes related to the string representation of the permissions.
Tail Merging pg 213
is a feature of some computer file systems which allows large blocks or allocation units to be used while making efficient use of “slack” space at the end of large files, space which would otherwise be lost for other use to internal fragmentation.
Set User ID (SUID)
is a special type of file permissions given to a file. Normally in Linux/Unix when a program runs, it inherits access permissions from the logged in user. SUID is defined as giving temporary permissions to a user to run a program/file with the permissions of the file owner rather that the user who runs it. In simple words users will get file owner’s permissions as well as owner UID and GID when executing a file/program/command.
Set Group ID (SGID)
is a special type of file permissions given to a file/folder. Normally in Linux/Unix when a program runs, it inherits access permissions from the logged in user. SGID is defined as giving temporary permissions to a user to run a program/file with the permissions of the file group permissions to become member of that group to execute the file. In simple words users will get file Group’s permissions when executing a Folder/file/program/command.
What does FHS stand for in Linux?
File system Hierarchy Standard(FHS)
what is a symbolic link?
its a separate file whose contents point to the linked to file.
force overwrite
the -f or –force options forces the system to overwrite any existing files.
interactive mode
-i or –interactive option causes cp to ask you before overwriting any existing files.
recursive copy
-r or –recursive option and specify a directory as the source option, the entire directory, including sub directories.
Archive Copy
-a or –archive option is similar to -R but it also preserves ownership and copies links as is.
Update Copy
-u or –update options tells cp to copy the file only if the original is newer than the target or if the target doesn’t exist.
tar command (tar) tape archiver
archive data to other media
tarballs
are often used for transferring multiple files between computers in one step, such as when distributing source code. A tarball is an archive file created by tar and typically compressed with gzip, xz, or bzip2
c, –create
x, –extract, –get
A, –catenate, –concatenate
Append tar files to an archive.
d, –diff, –compare
Append tar files to an archive.
–delete
Delete from the archive. (This function doesn’t work on magnetic tapes).
r, –append
Append files to the end of a tar archive.
t, –list
List the contents of an archive.
–test-label
Test the archive label, and exit.
u, –update
Append files, but only those that are newer than the copy in the archive.
x, –extract, –get
Extract files from an archive.
copy-out mode
This mode,activated by use of the -o or –create option,creates an archive and copies files into it.
copy-in mode
you activate copy-on mode by using the -i or –extract option. This mode extracts data from an existing archive. If you provide a filename or a pattern to match, cpio extracts only those files whose names match the pattern you provide.
copy pass mode
this mode is activated by the -p or –pass though option.
link
is a way to give a file multiple identities, similar to shortcuts in windows and aliases in Mac OS.
Three reasons Linux employs links?
1) help make files more accessible
2) give commands to multiple names
3) to enable programs that look for the same files in different locations to access the same files.
Hard links
are produced by creating two directory entries that point to the same file( more precisely the same mode)
ln command
creates hard links by default. The source file must exist before a hardlink is created.
permission bits
individual permissions such as execute access for the file owner are often referred to as permission bits.
/bin
this directory contains certain critical executable files such as ls,cp and mount.
/sbin
/sbin is a standard sub directory of the root directory in Linux and other Unix-like operating systems that contains executable (i.e., ready to run) programs. They are mostly administrative tools, that should be made available only to the root (i.e., administrative) user.
/lib
The /lib directory contains kernel modules and those shared library images (the C programming code library) needed to boot the system and run the commands in the root filesystem, ie. by binaries in /bin and /sbin. Libraries are readily identifiable through their filename extension of *.so. Windows equivalent to a shared library would be a DLL (dynamically linked library) file. They are essential for basic system functionality. Kernel modules (drivers) are in the subdirectory /lib/modules/’kernel-version’. To ensure proper module compilation you should ensure that /lib/modules/’kernel-version’/kernel/build points to /usr/src/’kernel-version’ or ensure that the Makefile knows where the kernel source itself are located
/opt
This directory is reserved for all the software and add-on packages that are not part of the default installation. For example, StarOffice, Kylix, Netscape Communicator and WordPerfect packages are normally found here. To comply with the FSSTND, all third party applications should be installed in this directory. Any package to be installed here must locate its static files (ie. extra fonts, clipart, database files) must locate its static files in a separate /opt/’package’ or /opt/’provider’ directory tree (similar to the way in which Windows will install new software to its own directory tree C:\Windows\Progam Files"Program Name”), where ‘package’ is a name that describes the software package and ‘provider’ is the provider’s LANANA registered name.
/mnt
This is a generic mount point under which you mount your filesystems or devices. Mounting is the process by which you make a filesystem available to the system. After mounting your files will be accessible under the mount-point. This directory usually contains mount points or sub-directories where you mount your floppy and your CD. You can also create additional mount-points here if you wish. Standard mount points would include /mnt/cdrom and /mnt/floppy. There is no limitation to creating a mount-point anywhere on your system but by convention and for sheer practicality do not litter your file system with mount-points. It should be noted that some distributions like Debian allocate /floppy and /cdrom as mount points while Redhat and Mandrake puts them in /mnt/floppy and /mnt/cdrom respectively.
/root
This is the home directory of the System Administrator, ‘root’. This may be somewhat confusing (‘root on root’) but in former days, ‘/’ was root’s home directory (hence the name of the Administrator account). To keep things tidier, ‘root’ got his own home directory. Why not in ‘/home’? Because ‘/home’ is often located on a different partition or even on another system and would thus be inaccessible to ‘root’ when - for some reason - only ‘/’ is mounted.
/dev
/dev is the location of special or device files.
/proc
/proc is very special in that it is also a virtual filesystem. It’s sometimes referred to as a process information pseudo-file system. It doesn’t contain ‘real’ files but runtime system information (e.g. system memory, devices mounted, hardware configuration, etc). For this reason it can be regarded as a control and information centre for the kernel. In fact, quite a lot of system utilities are simply calls to files in this directory. For example, ‘lsmod’ is the same as ‘cat /proc/modules’ while ‘lspci’ is a synonym for ‘cat /proc/pci’. By altering files located in this directory you can even read/change kernel parameters (sysctl) while the system is running.
-gid
searches for files whose group ID is set to gid.
whereis
it searches doe files in a restricted set of locations,such as standard binary files directories,library directories and ma pages directories.
-size
you can search for a file of a given size with the -size n expression.