File system Flashcards

1
Q

What is the find option for selecting files accessed n minutes ago?

A

-amin n

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

What is the find option for selecting a file accessed one day or more ago?

A

find -atime n (where n is n*24 hours ago. -atime +1 is a file that was accessed at least two days ago)

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

what find option will select a file changed n minutes ago?

A

find -cmin n

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

what find option will display the results?

A

find -print

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

what is a simple example of find to locate a wild card file name?

A

find . -name thename*.dat -print

start the search in the current directory .

use the name mask “thename*.dat”

print out the results to the screen

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

what is a find command to locate all core files and then remove them?

A

find / -name core -exec /bin/rm -f ‘{}’ \;

start in the root directory

use “core” as the name filter

execute the rm command

force the removal without prompting -f

pass the rm command the file name found ‘{}’ \;

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

What is the find option for selecting files accessed n minutes ago?

A

-amin n

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

What is the find option for selecting a file accessed one day or more ago?

A

find -atime n (where n is n*24 hours ago. -atime +1 is a file that was accessed at least two days ago)

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

what find option will select a file changed n minutes ago?

A

find -cmin n

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

what find option will display the results?

A

find -print

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

what is a simple example of find to locate a wild card file name?

A

find . -name thename*.dat -print

start the search in the current directory .

use the name mask “thename*.dat”

print out the results to the screen

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

what is a find command to locate all core files and then remove them?

A

find / -name core -exec /bin/rm -f ‘{}’ \;

start in the root directory

use “core” as the name filter

execute the rm command

force the removal without prompting -f

pass the rm command the file name found ‘{}’ \;

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

how do you set the sticky bit on an existing directory structure?

A

find /path/to/directory -type d -exec chmod g+s {} \;

This will recurse through the entire directory structure settingh the GID on all the directory objects (not the files) to the SETGID of the owner of the parent directory. All files created subsequently, will inherit the same GID of the parent directory instead of the default GID of the user who created the file.

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

what are the daemons used by nfs?

A

nfsd

rpcbind

rpc. idmapd
rpc. mountd
rpc. rquotad
rpc. statd

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

what is the tar command for copying an entire directory tree including the file permissions and links?

A

tar -cf - {source} | (cd {destination}; tar -xvf -)

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

Traverse the filesystem just once, listing setuid files and directories into /root/suid.txt and large files into /root/big.txt.

A

find / ( -perm -4000 -fprintf /root/suid.txt ‘%#m %u %p\n’ ), \
( -size +100M -fprintf /root/big.txt ‘%-10s %p\n’ )

17
Q

what command will show the server’s current exports?

A

showmount -e

18
Q

what command will list the users who have a file open?

A

lsof {filename}

19
Q

what command will show the PID of the process that has a file open?

A

fuser {filename}

20
Q

what command is used to change the system run level?

A

init { 0 1 2 3 4 5 6 }

0 — Halt

1 — Single-user text mode

2 — Multiuser but no NFS

3 — Full multi-user text mode

4 — Not used (user-definable)

5 — Full multi-user with X11

6 — Reboot

21
Q

what command shows the current run level?

A

who -r

22
Q

what file defines the default run level?

A

/etc/inittab

23
Q

what tools are provided by redhat to configure services?

A

chkconfig

ntsysv

redhat-config-services

24
Q

how do you locate all broken symlinks?

A

find / -name proc -prune -o -name dev -prune -o -type l ! -exec test -r {} \; -print

25
Q

how do you backup the MBR?

A

sudo dd if=/dev/sda of=mbr_backup bs=512 count=1

to restore it:

sudo dd if=mbr_backup of=/dev/sda bs=512 count=1

26
Q

what are the sequence of commands for creating a new partition?

A

create partition:
parted /dev/sda6 or mkpart for ext3

create filesystem:
mkfs -t ext4 /dev/sda6

*label it: *
e2label /dev/sda6 /work

add to fstab:
LABEL=/work /work ext3 defaults 1 2

**mount it: **
mount /work

27
Q

what command will show the UUID of the block or disk drives?

A

blkid

28
Q

what are the standard default options for fstab?

A

if the options field ( fourth column ) says “defaults”,

the usual values are:

rw,
suid,
dev,
exec,
auto,
nouser,
async(no acl support)

this can also be tuned with the tune2fs command.

29
Q

what commands are used to create partitions?

A

fdisk

sfdisk

cfdisk

parted

30
Q

what command script string will show all physical drives and their partitions if any?

A

for disk in ls /dev/sd[a-z]; do fdisk -l ${disk}; done

31
Q

what command is used to add a physical volume to a volume group?

A

vgextend <volgroupname> <pv></pv></volgroupname>

32
Q

what command is used to remove a pv from a vg?

A

vgreduce <vgname> <pvname></pvname></vgname>