Linux Professional Institute Exam 101 / LPIC 101

Chapter 2

Video 7: Section 102.3 - Manage shared libraries

- See on which libaries a command depends
    - # ldd {pathtocommand}
        -{pathtocommand} = /bin/ls
            - See witch libraries are used by the ls command
- In /etc is ld.so.cache which contains information about all the installed libaries
- In /etc is ld.so.conf which determines which files are in the ld.so.cache
    - Every file specified in this document will be included in this file
- In /etc/ld.so.conf.d are files that list where libraries are stored
- (re)create the ld.so.cache file
    - # ldconfig

Video 8: Section 102.4 - Debian Package Management (Ubuntu, Mint)

- Depackage (does not dependencies)
    - # dpkg {options} {package}
        - [ -l ] Give information about the package (or all if not specified)
        - [ -L ] Show the files that are installed by the package
        - [ -p ] Print all available information about the package
        - [ -P ] Remove the package AND its config
        - [ -i ] Install a *.deb file, and installs it anyway if it misses dependencies
        - [ -r ] Remove the package
        - [ -S ] Instead of a package a directory is needed. The program will tell from which package the files are from
- Debian Package Reconfigure, walks you trough the initial config (as if you reset)
    - # dpkg-reconfigure {package}
- Apt-Get (does dependencies)
    - # apt-get {options} {package}
        - [ upgrade ] Upgrades system and packages to a newer version (if available)
        - [ install ] Installs the specified package and its dependencies
        - [ remove ] Removes the specified package
        - [ autoremove ] The dependencies that are no longer used will be removed
        - [ update ] Updates the local file cache from the internet
- Apt-Cache
    - # apt-cache {options} {package}
        - [ search ] Search for keyword
        - [ show ] Show info of a package
        - [ depends ] Programs the package needs
        - [ repends ] What programs the package needs for it to work
- Aptitude
    - # aptitude {options} {package}
        - Without arguments it opens a menu based installer
        - Uses same options as apt-cache
- Repositories are stored in /etc/apt/sources.list

Video 9: Section 102.5 - RPM & YUM Packages (Redhat/CentOS/SUSE)

- YUM (automatic douwnloads the new cache, and installs the newest available package version)
    - # yum {options} {package}
        - [ install ] Installs the specified package
        - [ remove ] Removes the specified package
        - [ search ] Search for packages/descriptions matching the specified packagename
        - [ upgrade ] Searches for updated packages and asks if it should install them
    - Repositories are stored in /etc/yum.repos.d/
    - Settings for YUM can be found in /etc/yum.conf
- YUMDOUWNLOADER downloads the *.rpm file
    - # yumdownloader {options} {package}
        - [ --resolve ] resolves the dependencies and douwnloads them with the package
- RPM
    - # rpm {options} {package}
        - [ -i ] Install a *.rpm file, if dependencies are installed
        - [ -e ] Removes a package, if there are no packages depending on the package
        - [ -nodeps ] Ignores missing dependencies, and forces installation
        - [ -K ] Check signature to make sure this is a valid package
        - [ ..v ] Make any option use verbose, and print all information
        - [ -V ] Verify the package, no information means that everything is good
        - [ -q ] Displays the verion of the package
        - [ -qi ] Displays all the information of the package
        - [ -qd ] Shows where manual/info pages are stored, and some other information
- Convert a RPM file to a representation of the files in the package
    - # rpm2cpio {rpmfile}
- Convert a RPM file to a folder (extract)
    - # cpio {rpmfile}
- Convert Debian and RPM file back and forth using # alien

Video 14: Section 103.5 - Create, monitor and kill processes

- Cancel programs with [CTRL+C]
- Make a program run directly in the background
    - # ... &
        - Place the command on the ...
- Display programs running in the background
    - # jobs
    - When the terminal is closed, the programs are no longer in the jobs list but keep running
- Take a program out of the background and let it run in the foreground
    - # fg {jobnumber}
        - {jobnumber} = is found while running the jobs command
- Suspend a program that is running in the foreground with [CTRL+Z]
- Resume a suspended program in the background
    - # bg {jobnumber}
- Show all the processes running on the computer
    - # ps {options} {list}
        - [ a ] = All processes
        - [ u ] = Display the users that started the programs
        - [ x ] = Display all the commands that are running, even ones outside the running terminal
            - # ps aux
        - [ -e ] = Display everything
        - [ ..o ] = Decide output format, put fields to show in {list}
            - # ps -eo user,pid,cpu,nice,comm
- Kill a process (listed while running the ps command)
    - # kill {options} {procesid/pid}
        - [ -9 ] Send the killall (force stop)
- Kill all the processes running the same command
    - # killall {command}
    - You kill only the ones which you have permission to kill
    - Dangerous in root
- Lets the process keep running after logout
    - # nohup {command}
- Displays the resources that are used by a command. (refreshes automaticly)
    - # top
    - Standard the list is sources by CPU usage
    - Change the way the list is sorted by selecting different fields using the [<] and [>] keys
    - Press K to kill a command, enter the Proces ID (PID)
        - You can choose the way a program is killed (witch signal)
            - 15 = SigTerm (Please stop)
            - 9 = SigKill (Force Stop)
- Display the uptime of the system, number of user and load average
    - # uptime
    - Load average over 1 minute, 5 minutes, 10 minutes
- Display how the RAM is used
    - # free
    - Mem = actual memory
    - Swap = uses hard drive as RAM when actual ram is full

Video 15: Section 103.6 - Process Priorities

- Shows all the processes in a tree format
    # pstree
- NiceLevels
    - How lower the nice level the more cpu-time it gets
    - NiceLevels are -20 t/m 19
    - The default level commands get is 0
- Start a command with not the default nice level(when not specified, default nice level is 10)
    # nice {options} {command}
        - [ -n ] = Specify the nice level a command gets after option
            - Negative numbers need root access
- Set a different nicelevel to a running command
    # renice {nicelevel} {options}
        - [ -p ] = Specify process id after option
        - [ -u ] = Specify user name after option