Lab Questions for CSCI257


1) What command would change permissions on file1 to give the owner rwx, group rx, and other x?

a) chmod 742 file1

b) chmod 754 file1

c) chmod 751 file1

d) chmod 761 file1


2) What command would change permissions on file2 to give the owner write, group read, and other execute?

a) chmod 421 file2

b) chmod 241 file2

c) chmod 124 file2

d) chmod 412 file2


3) What command would set the SUID bit on file3?

a) chmod 0755 file3

b) chmod u+s file3

c) chown -s file3

d) setbit -s file3


4) What umask would you use if you wanted all of the files you created to have by default rwx for owner, rwx for group, read only for other?

a) umask 774

b) umask 771

c) umask 004

d) umask 003


5) On a Linux system the directory /etc contains which of the following:

a) Binary files

b) Device files

c) Configuration files

d) Process information


6) What command is used to find out what your PATH is on a Linux system?

a) echo $PATH

b) echo PATH

c) lspath

d) path


7) What field in /etc/passwd contains a users UID?

a) the first field

b) the second field

c) the third field

d) the fourth field


8) The /etc/shadow file contains what?

a) hidden user accounts

b) a backup copy of /etc/passwd

c) network configuration

d) the encrypted passwords of user accounts


9) What command is used to create user accounts on a Linux system?

a) mkaccount

b) useradd

c) mkuser

d) newuser


10) What command gives information about currently running processes on a Linux system?

a) sysinfo

b) procinfo

c) dmesg

d) top


11) What command can be used to find files in /etc containing the word “root” in them?

a) grep -r “root” /etc

b) find /etc “root”

c) locate /etc “root”

d) search /etc “root”


12) What command uses a database to find files?

a) grep

b) find

c) locate

d) search


13) What is the license of the Linux kernel?

a) GNL

b) OPL

c) GPL

d) GLP


14) What command tells how much disk space is being used by /bin on a Linux system with one partition?

a) du /bin

b) df /bin

c) space /bin

d) usage /bin


15) On a Linux system run level 3 is:

a) reboot

b) multiuser

c) single user

d) X11


16) On a Linux system run level 1 is:

a) reboot

b) multiuser

c) single user

d) X11


17) What command is for changing ownership of a file?

a) chmod

b) chown

c) own

d) owner


18) What file contains static information about file systems?

a) /dev/fstab

b) /etc/system

c) /proc/mtab

d) /etc/fstab


19) What command is used to change user passwords?

a) password

b) passwd

c) chpass

d) setpasswd


20) What are some directories typically found in the / directory on a Linux system?

a) /bin, /boot, /home, /linux, /opt, /sbin, /usr, /var

b) /bin, /dev, /home, /opt, /sbin, /usr, /sys, /var

c) /bin, /boot, /dev, /home, /opt, /sbin, /usr, /var

d) /bin, /dev, /home, /linux, /opt, /sbin, /sys, /usr, /var


21) How can the standard output of dmesg be redirected to a file named dmesg.txt?

a) dmesg > dmesg.txt

b) dmesg dmesg.txt

c) dmesg | dmesg.txt

d) dmesg -> dmesg.txt


22) What variable in bash scripting gives the number of arguments passed to the script?

a) $$

b) $#

c) $@

d) $arg


23) What variable in bash scripting gives the first argument passed to a script?

a) $first

b) $1

c) $var1

d) $arg


24) What type of links share the same inode as the file being linked to?

a) hard links

b) symbolic links

c) static links

d) inode links


25) What operator is used to redirect standard input from a file?

a) >

b) <

c) | (this is a pipe)

d) !


26) What operator is used to redirect standard output to a file?

a) >

b) <

c) | (this is a pipe)

d) !


27) What is #! /bin/bash at the top of a script for?

a) It is the standard unix convention for commenting

b) The #! means take the arguments and feed them to /bin/bash

c) It means use /bin/bash to interpret this script

d) It tells chmod to keep the executable bit set on this script


28) How do you write comments in a bash script?

a) // here is my comment

b) #! here is my comment

c) /* here is my comment */

d) # here is my comment


29) What command is used for adding groups on a typical Linux system?

a) mkgroup

b) groupadd

c) ngroup

d) newgroup


30) How can a single file have more than one group ownership?

a) You have to use chown with group names seperated by commas or colons

b) On generic Unix files can only have one group ownership

c) You use the groups command

d) You use the groupadd command


31) How can you concatenate 2 files named file1 and file2 into a third file named file3 using the cat command?

a) cat file1 file2 > file3

b) cat file1 file2 | file3

c) cat [file1-file2] file3

d) cat file1 file2 < file3


32) System V style initialization

a) Uses the /etc/init.conf file

b) Has symbolic links in directories like /etc/rc.d/rc1.d that point to scripts in /etc/rc.d/init.d

c) Uses scripts located in /etc/rc.d, one for each run level

d) Uses awk to parse the inittabs for each run level


33) Grub and LILO's configuration files are

a) /etc/grub.conf and /bin/lilo.conf

b) /etc/grub.conf and /sbin/lilo.conf

c) /boot/grub/grub.conf and /etc/lilo.conf

d) /sbin/grub/grub.conf and /sbin/lilo.conf


34) Where might you typically find the kernel on a Linux system?

a) /bin/linux

b) /sbin/linux

c) /dev/vmlinuz

d) /boot/vmlinuz


35) About how large is a standard sized Linux kernel (with compression)? (not a stripped down kernel for embedded systems or an unusually large bloated kernel)

a) about 1k

b) about 10k

c) about 100k

d) about 1MB

e) about 10MB


36) What command should be used to create a tar file named backup.tar which includes the directories dir1 and dir2 and their contents?

a) tar xvf backup.tar dir1 dir2

b) tar rfv dir1 dir2 backup.tar

c) tar cvf backup.tar dir1 dir2

d) tar cf dir1 dir2 backup.tar


37) What command should be used to extract a tar file named backup.tar?

a) tar xvf backup.tar

b) tar rfv backup.tar

c) tar cvf backup.tar

d) tar cf backup.tar


38) What command should be used to display permissions on a file?

a) ls -l

b) chmod

c) lsmod

d) perm

39) Which is a list of some of the configuration files used by bash?

a) /etc/profile, /etc/bash.config, .bashrc
b) /etc/bashrc, /etc/bash.config, .bash_config

c) /etc/bash.config, /etc/profile.bash, .bash_config

d) /etc/profile, /etc/bashrc, .bash_profile


40) Kernel modules are typically
a) kept in /lib/modules/

b) stored in a tar file in /boot

c) compiled directly into the kernel
d) compressed in a .gz file in /boot


41) What is the format of crontab entries?

a) year month day_of_month hour minute command

b) minute hour day_of_week day_of_month month command

c) minute hour day_of_month day_of_week month command

d) minute hour day_of_month month day_of_week command

42) What crontab entry would execute the command “cmd” every night at 1:05am?

a) 5 1 * * * cmd

b) 1 5 1 * * cmd

c) * 1 * * * cmd

d) * * * 1 5 cmd


43) What crontab entry would execute the command “cmd” half past every hour (12:30, 1:30, 2:30, etc)?

a) 1 * * * * cmd

b) 30 * * * * cmd

c) 30 1 * * * cmd

d) * * * * 30 cmd


44) Where are personal crontab files stored by default?

a) /etc/cron.d/
b) /etc/cron/

c) /var/spool/cron

d) /var/cron.d/


45) What is the “at” command for?

a) It is the same as cron except better since it can be done over a network

b) It is used to schedule a program to run at a certain time

c) It can be used to define break points in a shell script

d) Trick question, there is no “at” command

46) What command is normally used to list running processes?
a) ps

b) ls

c) proc

d) grep

47) What process has a UID of 1?
a) bash

b) the kernel

c) root

d) init

48) What command can be used to look up the ip address for a domain name?

a) nslookup

b) ping

c) netstat
d) arp

49) What command can be used to find out the route between your computer and another?

a) nslookup

b) ping

c) traceroute

d) route

50) Using command line ftp what is the command to download a file?
a) put

b) cp

c) download

d) get

51) Using command line ftp what is the command to upload a file?
a) put

b) cp

c) up

d) get

52) What is the name of a command line text-only browser?
a) galeon

b) ftp

c) mozilla

d) lynx