Shared Flashcard Set

Details

rhel 5 training guide ch 02
Files and Directories
142
Computer Science
Professional
03/08/2010

Additional Computer Science Flashcards

 


 

Cards

Term
what are the two file systems created by default when RHEL is installed
Definition
/ and /boot
Term
FHS
Definition
File-system Hierarchy Standard (FHS)
Term
Virtual file system
Definition
memory based file system, created at boot up
Term
disk-based file system
Definition
created on physical media
Term
Root file system
Definition
/ - the top level file system in the FHS
Term
/bin
Definition
the binary directory, holds crucial executable commands, contains static data files
Term
/lib
Definition
library directory, shared files, disk-based, contains static data files
Term
/sbin
Definition
system binary directory, crucial system administration commands, contains static data files
Term
/etc
Definition
etcetera directory, system configuration files, contains dynamic data files
Term
/lost+found
Definition
files that have lost their name (system crash)
Term
command to recreate lost+found directory
Definition
mklost+found
Term
/root
Definition
home directory of the user root
Term
/srv
Definition
server data for web sites, databases, etc.
Term
/boot
Definition
disk based, contains kernel(s), boot loader, boot configuration files, default size 100MB, static files
Term
/var
Definition
frequently changed data, including /var/log, /var/spool/mail
Term
/var/spool
Definition
holds print jobs, cron jobs, email messages, other queued items
Term
/var/tmp
Definition
large temporary files and files that need to survive reboots
Term
/usr
Definition
Unix System Resources (/usr) contains general fles related to the system
Term
/usr/bin
Definition
additional executable commands
Term
/usr/sbin
Definition
additional system administration commands
Term
/usr/local
Definition
sys admin repository for commands and tools downloaded or added to the system
Term
/usr/local/bin
/usr/local/etc
/usr/local/man
Definition
downloaded or added executable files,
etc holds their configuration files, man holds the man pages
Term
/usr/include
Definition
contains header files for C
Term
/usr/share
Definition
shared man pages and documentation, and configuration files
Term
/usr/lib
Definition
library files for programming sub-routines
Term
/tmp
Definition
dumping ground for temporary files, many created by programs
Term
/opt
Definition
additional software packages installed on the system, each with a sub-dir
Term
/home
Definition
contains home directories for user files
Term
/dev
Definition
device files for hardware and virtual devices, a virtual file system
Term
block device file
Definition
data is moved in blocks, often with random access
Term
character device file
Definition
data is accessed in a serial manner, such as a mouse, keyboard, or serial printer
Term
/net
Definition
AutoFS will mount NFS file systems here. Virtual file system
Term
/media
Definition
a Virtual file system where removable media is automatically mounted
Term
/misc
Definition
a virtual file system where AutoFS mounts local resources
Term
/proc
Definition
a virtual file system containing dynamic data files with information about the current state of the running kernel
Term
/sys
Definition
System file system, a virtual file system, contains information about the currently configured hardware
Term
/selinux
Definition
SELinux file system - contains all current settings for SELinux
Term
how is the absolute path started
Definition
/
Term
enter ll, what is the prefix for link files
Definition
l
Term
enter ll, what is the prefix for directories
Definition
d
Term
command to display detailed information about a file
Definition
file
Term
command to determine what a linked file is linked to
Definition
file
Term
enter ll, what is the prefix for a character (raw) device file
Definition
c
Term
enter ll, what is the prefix for a block device file
Definition
b
Term
command to get detailed information about a device file
Definition
file
Term
named pipe file
Definition
AKA - a FIFO, used for Inter Process Communication (IPC)
Term
enter ll, what does the prefix p mean
Definition
a named pipe, aka FIFO, used for IPC (Inter Process Communication)
Term
Socket file
Definition
works as a two way named pipe, used for IPC
Term
enter ll, what does the s prefix mean
Definition
a socket - used for two way communication
Term
the max number of alphanumeric characters of a file or directory name
Definition
255
Term
create a new file using cat
Definition
cat > newfile
enter text
ctrl+d to exit
Term
create a new empty file
Definition
touch newfile
Term
make a new directory
Definition
mkdir newdir
Term
make a directory and subdirectories
Definition
mkdir -p scripts/perl/perl5
Term
show the first 10 lines of a file
Definition
head filename
Term
show the first 3 lines of a file
Definition
head -3 filename
Term
show the last 10 lines of a file
Definition
tail filename
Term
show the last 3 lines of a file
Definition
tail -3 filename
Term
what does view filename do?
Definition
opens a file in the vi editor
Term
extract the legible information from a file
Definition
string filename
Term
what does the string command do
Definition
displays legible information embedded in a non-text or binary file
Term
copy a file and automatically overwrite
Definition
cp file1 newfile1
Term
copy a file and prompt if the file already exists
Definition
cp -i file1 newfile1
Term
what is the switch to have cp prompt before overwriting a file
Definition
cp -i
Term
what is the recursive option for the cp command
Definition
cp -r
Term
rename file3 to file4
Definition
mv file3 file4
Term
remove a file
Definition
rm newfile
Term
remove a file, but be prompted before removing
Definition
rm -i filename
Term
remove an empty directory
Definition
rmdir dir1
Term
remove a full directory
Definition
rm -r dirname
Term
remove a full directory, but get prompted for each item
Definition
rm -ri dirname
Term
move a file, but prompt before overwriting anything
Definition
mv -i file1 subdir1
Term
display file statistics on a file
Definition
stat filename
Term
find the last accessed time of a file
Definition
stat filename
Term
display the available space of a directory
Definition
stat dirname
Term
display directory statistics
Definition
stat dirname
Term
look for a the pattern "root" in /etc/group and show line numbers
Definition
grep -n root /etc/group
Term
command to change an attribute
Definition
chattr
Term
display file attributes
Definition
lsattr filename
Term
set a file so that it cannot be changed, renamed, or deleted
Definition
chattr +i filename
Term
set a file so that the access time cannot be changed
Definition
chattr +A filename
Term
set a file so that it can only be appended
Definition
chattr +a filename
Term
set a file so that it cannot be deleted
Definition
chattr -u filename
Term
set a file so that it cannot be backed up with dump and cannot be changed, even by root
Definition
chattr =id filename
Term
search a file and exclude the pattern "root"
Definition
grep -v root filename
Term
show the line numbers for the pattern "root" in /etc/group
Definition
grep -n root /etc/group
Term
display the names of the files that show the pattern user1 in a list of files
Definition
grep -l user1 /etc/group /etc/passwd /etc/hosts
Term
search for the lines that begin with root in /etc/passwd
Definition
grep ^root /etc/passwd
Term
search for all the empty lines in /etc/passwd
Definition
grep ^$ /etc/passwd
Term
search for root, or Root in /etc/password
Definition
grep -i root /etc/passwd
-i = ignore case
Term
print all the lines from the ll /etc output that show drwx or xin
Definition
ll /etc | grep -E 'drwx|xin'
Term
find a file named filename starting at root
Definition
find / -name filename
Term
compare two files, display the results in three sections
Definition
diff -c file1 file2
Term
find files larger than 100MB in the usr directory
Definition
find /usr -size +100M
Term
show lines of /etc/passwd that only contain "root" and nothing else
Definition
grep ^root$ /etc/passwd
Term
what is the command syntax for find, "find", then what
Definition
find, path, option, action
Term
find files smaller than 1GB in root's home directory
Definition
find ~ -size -1G
Term
find files larger than 1GB in your home directory
Definition
find ~ -size +1G
Term
find files in /home that have user1 as the owner and group
Definition
find /home -user user1 -group user1
Term
find files in /home that have the owner as user1, but the group as something else
Definition
find /home -user user1 -not -group user1
Term
find files in /etc/rc.d that were modified more than 120 days ago
Definition
find /etc/rc.d -mtime +120
Term
find files in / named core not owned by root
Definition
find / -name core -not -user root
Term
find files in /etc/rc.d that were modified exactly 10 days ago
Definition
find /etc/rc.d -mtime 10
Term
find files in /etc/rc.d that have not been accessed in the last 90 days
Definition
find /etc/rc.d -atime -90
Term
find character files in /dev with 666 permissions
Definition
find /dev -type c -perm 666
Term
find link files in /usr with 777 permissions
Definition
find /usr -type l -perm 777
Term
find files in /usr that have at least 444 permissions
Definition
find /usr -perm -444
Term
find character files in /dev that are world writable
Definition
find /dev -type c -perm -222
Term
find block device files in /dev with the write bit set at any of the three levels
Definition
find /dev -type b -perm +222
Term
search for core files in the entire directory tree and prompt to delete them if found
Definition
find / -name core -ok rm {} \;
Term
find core files in the entire directory tree and delete them without prompting
Definition
find / -name core -exec rm {} \;
Term
find core files starting in / and rename them to the same name with .old extension
Definition
find / -name core -exec mv {} {}.old \;
Term
what db does locate use
Definition
mlocate.db
Term
where is mlocate.db
Definition
/var/lib/mlocate/mlocate.db
Term
how is mlocate.db updated
Definition
updated daily with /etc/cron.daily/mlocate.cron
Term
how can mlocate.db be updated manually
Definition
updatedb
Term
how often is the database used by locate updated
Definition
mlocate.db is updated daily via the mlocate.cron script
Term
how does locate work
Definition
checks the mlocate.db for the string entered
Term
locate files with "passwd" in the name
Definition
locate passwd
Term
locate 3 occurrences of passwd
Definition
locate -n 3 passwd
Term
locate all files with the .sh extension and list the first five
Definition
locate -n 5 .sh
Term
sort a file alphabetically
Definition
sort filename
Term
sort a file numerically
Definition
sort -n filename
Term
sort a file on the second column
Definition
sort -k 2 filename
Term
sort a file numerically on the second column
Definition
sort -k 2 -n filename
Term
sort a file numerically in reverse order
Definition
sort -nr filename
Term
sort the output of the ll command
Definition
ll / | sort
Term
sort the output of ll on the 6th column which is sorting by the months
Definition
ll / | sort -k 6M
Term
sort the results of ll and place them in a file sort.out
Definition
ll / | sort -o /tmp/sort.out
Term
ls -al /etc/skel and sort on the 6th (months) and 7th column
Definition
ls -al /etc/skel | sort -k 6M -k 7
Term
what is the unique number assigned to each file as it is created
Definition
inode
Term
inode AKA
Definition
index node
Term
soft link AKA
Definition
symbolic link / symlink
Term
explain soft link
Definition
like a pointer. Can cross file system boundaries. Can be used to link directories
Term
link two directories
Definition
ln -s dir1 dir2
Term
symlink two files. the original file is named filename
Definition
ln -s filename linkfile
Term
do an ll showing inode numbers
Definition
ll -i
Term
there is a symbolic link to a file, the orignal is deleted, what happens to the link
Definition
it stays put, but points to something that does not exist
Term
what is a hard link
Definition
an association of two or more files to a single inode number. The files are then identical
Term
limitations of a hard link
Definition
can't link across file systems and can't link directories
Term
file2 exists, hard link file20 and file2
Definition
ln file2 file20
Term
file2 exists, hard link file20 and file2
Definition
ln file2 file20
Supporting users have an ad free experience!