LPI Linux Certification/LPI-101 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 Modem and Sound cards

      Setup SCSI Devices

      Setup different PC expansion cards

      Configure Communication Devices

      Configure USB devices

      ↑Jump back a section

      Linux Installation & Package Management

      Design hard disk layout

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

      Install a boot manager

      Make and install programs from source

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

      Manage shared libraries

      Use Debian package management

      To see what will be installed on your computer, use the command:
       dpkg -c package_name.deb
      If the package is already installed, you can see also what files were installed:
       dpkg -L package_name
      

      dpkg-reconfigure <package name>

      Use Red Hat Package Manager (RPM)

      To see what will be installed on your computer, use the command:
       rpm -qpl package_name.rpm
      
      ↑Jump back a section

      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?



      Process text streams using filters

        1. Use wildcard characters and list all filenames that contain any character followed by 'in' in the /etc directory.
             ls /etc/in*
      
        2. Use wildcard characters and list all filenames that start with any character between 'a' and 'e' that have at least two more characters and do not end with a number.
             ls [a-e]?[!0-9]
        3. Use wildcard characters and list all filenames of exactly 4 characters and all filenames starting with an uppercase letter. Do not descend into any directory found.
             ls -d [A-Z]???
        4. Use wildcard characters and list all files that contain 'sh' in /bin.
        5. Display your environment variable HOME preceded by the string "$HOME value is:"
        6. Display the contents of $SHELL with two asterisk characters before and after it.
        7. How would you display the following string of characters as is with echo using double quote and \.
               * @ # $ % ^ & * ( ) ' " \
        8. Compose echo commands to display the following two strings:
               * That's what he said!
               * 'Never Again!' he replied.
        9. Display the number of words in all files that begin with the letter 'h' in the /etc directory.
       10. How would you send a 2M (megabyte) file with two 1.44 M floppy. How would you put back together the split file?
       11. What is the command to translate the : delimiter in /etc/password by #?
      

      Perform basic file management

        1. Compose an interactive command to remove all .tmp files in your home directory. Respond y to every prompt.
      

      rm -i ~/*.tmp

        2. List all the files in the user's home directories ending with .pdf that are bigger than 50 blocks and have not been accessed for a month.
      

      find /home -name "*.pdf" -atime +30 -size +50 -print

        3. Create a file file.h that will contain all the filenames ending with .h found in the /usr directory.
      

      find /usr -name "*.h" > file.h

        4. Do a touch on all the c files found in /usr/src/packages directory.
        5. What are the default permissions when you create a new file and a new directory?
           new file --> 644
           new directory --> 755
      
        6. How would you create a new file or directory that contains a space in the filename? (Example: 'new dir')
           touch new\ file.txt
           mkdir new\ dir
            
        7. What is the command to remove all the files of types char and block in your home directory?
      
        8. How would you find the location of the program find?
        9. Delete all files in /tmp which are not owned by root and have not been accessed for a week.
      

      Use streams, pipes, and redirects

      1. Create a file list.bin that will contain all the file names from the /bin directory.

      ls /bin > list.bin
      

      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.

      ls /usr/local/bin >> list.bin 2>/dev/null
      

      3. Split your list.bin file into files that are 50 lines long and remove list.bin.

      split -l 50 list.bin
      rm -f list.bin
      

      4. From the split files recreate list.bin (but with inversed order).

      cat xab xaa > list.bin
      

      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.

      ls /sbin | tee sbin.txt
      

      8. Create a file that within the filename you include the creation time.

      ls -l /sbin > `date +%d_%m_%y.txt`
      

      9. Create a file that will contain all the filenames in reverse order with extension .conf from the /etc directory. ls *.conf

      ls /etc/*\.conf > first.txt
      tac first.conf > end_list.txt
      rm -f first.txt
      

      Create, monitor, and kill processes

      1. How can you control CPU usage for PID 3196

      top -p 3196
      

      Modify process execution priorities

      Search text files using regular expressions

      Perform basic file editing operations using vi

      All of the vi commands below must of course be entered in command mode.

      1. vi foo
      2. Most frequently one would use i, but there are other ways of getting into command mode.
      3. ZZ
      4. vi foo
      5. 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.
      6. press esc to get out of command mode
      7. :q!
      ↑Jump back a section

      Devices, Linux Filesystems, Filesystem Hierarchy Standard

      Create partitions and filesystems

      Maintain the integrity of filesystems

      Control mounting and unmounting filesystems

      Managing disk quota

      Use file permissions to control access to files

      Manage file ownership

      Create and change hard and symbolic links

      Find system files and place files in the correct location

      ↑Jump back a section

      The X Window System

      Install & Configure XFree86

      Setup a display manager

      Install & Customize a Window Manager Environment

      ↑Jump back a section

      Read in another language

      This page is available in 1 language

      Last modified on 4 February 2013, at 13:18