# LPI Linux Certification/LPI-101 Exercises results

* LPIC1 Exam 101
* Detailed_Objectives
* Hardware & Architecture
* Linux Installation & Package Management
* GNU & Unix Commands
* Linux Filesystems
* The X Window System
* Exercises results

## Hardware & Architecture
### Configure Fundamental BIOS Settings

To show the amount of physical RAM available: free or cat /proc/meminfo | grep MemTotal Which are the devices that are sharing an interrupt line? cat /proc/interrupts | more How many PCI buses and bridges are there? lspci | wc -l Are there any PCI/ISA bridges? lspci | grep 'PCI\|ISA' What is the option with lspci to list all the Intel PCI devices? lspci -d 8086:* What is the command to set you IDE hard drive in read only mode? hdparm -r1 <device> What is the command to turn on/off the disk cache hard drive? hdparm -W1 <device> hdparm -W0 <device> What does the setpci utility do? setpci is a utility for querying and configuring PCI devices. What would be the command to write a word in register N of a PCI device? setpci -s 12:3.4 N.W=1 .

### Configure USB devices
## Linux Installation & Package Management
### Design hard disk layout

To display periodically the virtual memory usage: vmstat -n 1

### Make and install programs from source

What steps should you follow to compile and install a program from source? ./configure make make install

### Use Debian package management

dpkg-reconfigure <package name>

### Use Red Hat Package Manager (RPM)
## GNU & Unix Commands
### Working on the command line

Get information on the useradd and userdel commands. man useradd man userdel Assuming you have $PAGER set to less; Use SPACE to advance by one page, B to go back.
Create two new accounts user1 and user2 and set the passwords to those accounts with the passwd command. As root lock the accounts and check if you can still log in.
What is the command to concatenate files? cat file1 file2
Declare and Initialize the following environment variables NAME and LASTNAME. Use echo to print them out. set NAME="Joe" set LASTNAME="Bloggs" echo "$NAME $LASTNAME"
Start a new bash (type bash) and check that you can still see those declared variables. No
Use exec to start a new bash session. Can you still see those declared variables? Yes
Use date to display the month.
Add a new user named notroot with root's rights and lock the root account.GNU and UNIX Commands
This is a trick question. The only account with root privileges is the one with a UID of zero.
One could alter /etc/passwd so that “root” is called something else, which would have the a similar effect; the account “root” would no longer exist. With the possible exception of translation to a foreign language, I can’t see the point in doing this.
You could set the SUID bit on all files on the file system for that authentic “Redmond style" security but again, why would you want to?

### Perform basic file management

rm -i ~/*.tmp
find /home -name "*.pdf" -atime +30 -size +50 -print
find /usr -name "*.h" > file.h

### Use streams, pipes, and redirects

1. Create a file list.bin that will contain all the file names from the /bin directory.
2. Write a command that will append the list of files from /usr/local/bin to the file named list.bin and discard any error output.
3. Split your list.bin file into files that are 50 lines long and remove list.bin.
4. From the split files recreate list.bin (but with inversed order).
7. Write a command that will create a file list.sbin with the contents of /sbin and at the same time display it to standard output.
8. Create a file that within the filename you include the creation time.
9. Create a file that will contain all the filenames in reverse order with extension .conf from the /etc directory. ls *.conf

### Create, monitor, and kill processes

1. How can you control CPU usage for PID 3196

### Perform basic file editing operations using vi

All of the vi commands below must of course be entered in command mode.
* vi foo
* Most frequently one would use i, but there are other ways of getting into command mode.
* ZZ
* vi foo
* o opens a new line beneath the cursor position and drops you into command mode. i puts you directly into command mode without making the new line, so o is more efficient.
* press esc to get out of command mode
* :q!

## Devices, Linux Filesystems, Filesystem Hierarchy Standard
### Manage file ownership

1.
2.
3.
File permissionsː Logically AND with 0666
Directory permissionsː Locically AND with 0777
File permissionsː Logically AND with 0666
Directory permissionsː Locically AND with 0777
File permissionsː Logically AND with 0666
Directory permissionsː Locically AND with 0777
File permissionsː Logically AND with 0666
Directory permissionsː Locically AND with 0777

### Create and change hard and symbolic links

1.
2.
2.
4.
5.
The ~/bin/ls file gets lost in neither of the cases.