IT340 Mid Term
What is a pipe
helps mash-up two or more commands at the same time
How to exit fdisk
q OR wq
What does the "runlevel" command do?
reveals current runlevel
How to delete files/directories
rm <file/dir>
How to verify package
rpm -V <packagename>
How to remove package
rpm -e <packagename>
How to instal package
rpm -ivh <packagename>
How to verify package isn't installed
rpm -q <packagename>
How to display package information
rpm -qpi <packagename>
How to reboot computer
shutdown -r now
How to use sort
sort <filename>
What is sort
sorts content alphabetically
How to acquire root privileges
su -
How to switch runlevels?
telinit <runlevel> *1 thru 5
Create Files
touch <filename>
How to unmount
umount <diskpath>
How to create new user accounts
useradd <username>
How to use vi editor
vi <filename>
Common VI commands
1. I INSERT 2. a APPEND TO RIGHT 3. d DELETE AFTER CURSOR 4. x DELETE CHAR 5 :q QUIT w/out SAVING 6. arrows TO MOVE 7. dd DELETE LINE 8. esc COMMAND MODE 9. :wq SAVE AND QUIT
How to mount new disk
1. Run mkdir /mnt/<newname> 2. mount <diskpath> <newname>
How to view Xorg
1. command Xorg - configure 2. ls org.confg.new
What is word count (wc) command
It is used to find out number of lines, word count, and characters count in the files specified in the file arguments
Do you need to specify complete path if you are in the directory you want to work with?
No
How to use Autofill
Press tab
A system's disk accesses have been behaving strangely, so you run fsck on the affected partition. This utility reports that it's fixed several errors. What more should you do? a. Run mkfs to ensure that the problem is corrected. b. Be alert to a recurrence of the problem. c. Replace the affected hard disk. d. Enlarge the affected partition with GNU Parted.
b. Be alert to a recurrence of the problem.
What does the renice program do? a. It finds and terminates programs that consume too much CPU time b. It changes the priority of a running process c. It searches for security breaches by local users d. It optimizes programs' executables so they consume less CPU time
b. It changes the priority of a running process
What can symbolic links do that hard links cannot do? a. Use different names for the link and the linked-to file b. Link files on two different filesystems c. Enforce identical permissions on the link and the original file d. Provide easy access from GUI file managers
b. Link files on two different filesystems
You type ps -lx and find that the PPID value for xv is 17047. What does this fact mean? a. The process ID of the ps process was 17047 b. The process with ID 17047 forked xv c. The process ID of xv is 17047. d. The xv process forked a process with the process ID 17047.
b. The process with ID 17047 forked xv
You type ps ax to view the processes running on the system, but the output is too long to fit on your screen. How might you redirect the output to a file so that you can study it in a text editor? a. Type ps ax | psax.txt b. Type ps ax > psax.txt c. Type redir 'ps ax' psax.txt d. Type redir psax.txt 'ps ax'
b. Type ps ax > psax.txt
Which of the following commands will display the contents of the $PATH environment variable from a bash shell? a. shell $PATH b. echo $PATH c. display $PATH d. envar $PATH
b. echo $PATH
You've compiled and installed an obscure library (obscurelib) from source code to support a program you've already installed. Assuming the library files have been installed in a directory that's already on your library path, what command do you need to type to ensure that the new library will be available to programs? a. ld_library_path b. ldconfig c. ldd obscurelib d. hashlib
b. ldconfig
When you use USB flash drives, they are identified as /dev/sdb in Linux. A colleague who uses Windows XP gives you a partitioned USB flash drive with some data you need to access and tells you it's formatted using FAT. Which of the following commands is most likely to successfully mount the flash drive at /media/usb, when typed as root? a. mount -t vfat /dev/sdb /media/usb b. mount -t vfat /dev/sdb1 /media/usb c. mount -t msdos /dev/sdb /media/usb d. mount /dev/hdb1 /media/usb
b. mount -t vfat /dev/sdb1 /media/usb
Which of the following commands can provide information that will help you identify programs that consume too much CPU time? a. uptime b. top c. df d. cat /proc/cpuinfo
b. top
What shell is used in CentOS?
bash
What is the VI editior
built into linux, can edit files
You type head -n 20 logfile.txt to review a log file created by an application. What is the result of typing this command? a. The first 20 lines of logfile.txt that contain the string head are displayed on the screen. b. The last 20 lines of logfile.txt are displayed on the screen. c. The first 20 lines of logfile.txt are displayed on the screen. d. Log entries from logfile.txt with a priority weight of 20 or greater are displayed on the screen.
c. The first 20 lines of logfile.txt are displayed on the screen.
Which of the following commands will prepare a swap partition (/dev/sda7) for use? a. swapon /dev/sda7 b. mkfs -t swap /dev/sda7 c. mkswap /dev/sda7 d. dd if=/dev/zero of=/dev/sda7
c. mkswap /dev/sda7
Which utility can you use to determine the CPU load at any given moment? a. df b. free c. uptime d. ps
c. uptime
How to use grep
cat sample | grep <searchitem>
Change Directory
cd <location>
How to change file permissions?
chmod <octalnums> <file>
How to change ownership
chown [OPTIONS] USER[:GROUP] FILE(s)
How to use copy command
cp <source> <destination>
How to delete partition
d
As an ordinary user, typing /sbin/ifconfig produces information about your network interfaces, but typing ifconfig produces a command not found error message. Why? a. The ifconfig program file is located in /bin, not in /sbin. b. ifconfig refuses to run for ordinary users as a security measure. c. A library upon which ifconfig relies has not been properly installed. d. /sbin is not on your path, so bash can't find it without a complete path specification.
d. /sbin is not on your path, so bash can't find it without a complete path specification.
You want to give ownership of a file you've created to another user. What must you do before you can do this with chown? a. Ensure that the target user has read access to the file. b. Place the file in a directory owned by the target user. c. Place the file on an ext2 filesystem d. Acquire root privileges.
d. Acquire root privileges.
Which of the following is a major problem that advanced package management systems solve? a. Use of the same source code across OSs b. Consistent naming of files across distributions c. Quick and easy installation of new program files d. Identification of conflicts between files and packages
d. Identification of conflicts between files and packages
Where may users' home directories reside? a. Only in the /home directory b. Only in the /users directory c. In any directory that resides on its own partition d. In any directory that can hold normal files
d. In any directory that can hold normal files
What's wrong with the following command? # mkfs -t ext2 /dev/fd0 a. You cannot use ext2fs on a floppy disk (/dev/fd0). b. The command to create an ext2 filesystem is mke2fs, not mkfs. c. The filesystem specification (-t ext2) must come after the device specification (/dev/fd0). d. Nothing is wrong with this command.
d. Nothing is wrong with this command.
How to pipe
(command1) sample | (command2)
Permission Types
0 * No Permission * — 1 * Execute * -x 2 * Write * -w- 3 * Execute + Write * -wx 4 * Read * r- 5 * Read + Executer * -x 6 * Read +Writer * w- 7 * Read + Write +Execute * rwx
What is a symbolic link?
A soft link is essentially a pointer or reference to an actual file
What is a hard link?
Connection between file name and Inode number). If file is renamed, link will stay.
What is the "fdisk" command?
This is used for creating and manipulating disk partition table. It is used for the view, create, delete, change, resize, copy and move partitions on a hard drive using the dialog-driven interface.
Display Previous Commands
Up Arrow Key
What is grep?
Use it to search for words or content within a file or files
What does the following command accomplish? # chown one:two three a. It assigns ownership of the file three to the user one and the group two. b. It assigns ownership of the file one to the owner two and the group three. c. It assigns ownership of the file two to the owner one and the group three. d. It assigns ownership of the file one to the owner three and the group two.
a. It assigns ownership of the file three to the user one and the group two.
What does the pwd command do? a. It displays the name of the current working directory. b. It creates a password-protected directory. c. It summarizes available disk space on your partitions. d. It performs defensive checks of a password.
a. It displays the name of the current working directory.
What symbol denotes the start of a line in a regular expression? a. The carat (^) b. The vertical bar (|) c. The dot (.) d. The dollar sign ($)
a. The carat(^)
What method do some SUID and SGID programs use to minimize the risks inherent in using these features? a. The program files are owned by somebody other than root. The owner has special privileges to access just those files that the process needs. b. An SUID root program may not set the SGID bit. This denies access to the group's resources, thus improving security. c. The SUID and SGID bits may be set in the RPM or Debian package file. This assures you that they're necessary. d. An SUID root program may require you to use su to acquire root privileges before you can run the program.
a. The program files are owned by somebody other than root. The owner has special privileges to access just those files that the process needs.
Under which of the following circumstances might you need to edit the /etc/fstab file's contents? a. You've added a hard disk to the computer. b. You've inserted an optical disc into the computer's DVD drive. c. The system performs a disk check and reports no errors. d. You've changed /boot/grub/menu.lst boot options.
a. You've added a hard disk to the computer.
You want to temporarily add the directory /usr/local/tempbin to the list of directories Linux searches for commands. What would you type at a bash prompt to accomplish this goal? a. export PATH=$PATH:/usr/local/tempbin b. export PATH=/usr/local/tempbin c. PATH=/usr/local/tempbin d. PATH=$PATH+/usr/local/tempbin
a. export PATH=$PATH:/usr/local/tempbin
You try to use the rpm command to install newpackage-2.7-2.i386.rpm on a Fedora Linux computer, but you're met with a message to the effect that this package depends on several other packages that aren't installed. How can you resolve this problem? a. Submit a bug report and wait for the developers to release a new package b. Use dpkg, rather than rpm, to install newpackage c. Use inpkg, rather than rpm, to install newpackage d. Track down the missing packages and install them using rpm, then install newpackage
d. Track down the missing packages and install them using rpm, then install newpackage
After a power outage, the miniprog program begins misbehaving, so you suspect that a critical miniprogfile may have been damaged. How might you check for such damage on a system that uses RPM for package management? a. Type rpm -e miniprog b. Type rpm -q miniprog c. Type rpm -Uvh miniprog d. Type rpm -V miniprog
d. Type rpm -V miniprog
How do nice and renice differ? a. nice may increase or decrease a process's priority; renice may only decrease a process's priority b. nice may be used by ordinary users or by root; renice may be used only by root c. nice modifies the priority of a program by PID number; renice modifies the priority of a program by process name d. nice modifies the priority of a program when you launch it; renice modifies the priority of a program that's already running
d. nice modifies the priority of a program when you launch it; renice modifies the priority of a program that's already running
You want to print a plain-text (ASCII) file, but you want to include line numbers and page numbers in your printout. What tool can you use to add these features prior to printing the file? a. nm b. wc c. gs d. pr
d. pr
What command can you use in a pipe to create two copies of standard output from a program, one going to a file and the other going to the screen? a. fork b. make c. ifdef d. tee
d. tee
You want to know how many words are in a plain ASCII document, paper.txt. What command could you type to learn this information? a. nl paper.txt b. count paper.txt c. words paper.txt d. wc paper.txt
d. wc paper.txt
How to check file system
df -h
Display $PATH Variable
echo $PATH
How to redirect output
echo (something) > (new.txt)
How to leave root
exit
How to leave terminal
exit
How to identify new disk
fdisk -l
How to create partition
fdisk <path to disk>
How to display contents of file
less -l <filename> *shows scroll OR cat <filename> *shows last page
View What is in Current Directory
ls -l
How to make scratch directory
mkdir /tmp/scratch
Make Directory
mkdir <directory name>
How to make File System
mkfs -t <filesystemtype> <diskpath>
How to move files
mv <source> <destination>
How to create new partition
n
How to set password for new accounts
passwd <username>
How to write file
w
How to use wc
wc <filename> "lines, words, chars"
How to use yum
yum install <packagename> *will automatically search for it