LPI 101

From Initq

Jump to: navigation, search

Linux Professional Institute developed LPCI-1 exams (101 and 102). We are going to cover exam 101 in this section and show you anything that you might encounter on this test.

Contents

Linux Command Line Tools

Everything you do on a linux box is done through a shell. A shell is a program that accepts and interprets text mode commands.

There are many different types of shells for the linux environment.

  • bash The GNU Bourne Again Shell is based on Bourne shell for Unix but extends it in several ways. In Linux, bash is the most common default shell for user accounts. LPI also emphasizes only bash in their exam.
  • bsh The Bourne shell is not often used in Linux and normally the bsh command is symbolic link to bash.
  • tcsh This shell is based on the earlier C shell. No Linux distro makes this the default but it is available for use in the packages.
  • csh The C shell isn't used on linux but it's still good to know it.
  • ksh The Korn Shell is mostly used on aix machines but not on linux.
  • zsh The Z shell is an enhancement of the ksh.

To check for your default shell you can do:

 qais@qais:~$ ls -la /bin/sh
 lrwxrwxrwx 1 root root 4 2008-01-10 02:01 /bin/sh -> bash
 qais@qais:~$               

On some *nix systems you can also do this:

 qais@qais:~$ cat /etc/shells
 # /etc/shells: valid login shells
 /bin/csh
 /bin/sh
 /usr/bin/es
 /usr/bin/ksh
 /bin/ksh
 /usr/bin/rc
 /usr/bin/tcsh
 /bin/tcsh
 /usr/bin/esh
 /bin/bash
 /bin/rbash
 /usr/bin/screen
 qais@qais:~$

You can get a full list of commands here but some simple commands that are used in LPIC 101 test are the following. cd is used for changing directories within your shell. echo is used to echo text on the screen. exit and logout are used to terminate the shell. pwd is use to find your current location in the directory structure. set and unset are use to set wide verity of options within your shell. Two of the first command that every one learns is ls and mv. When you work with linux you will mostly be working with the cli (command line interface). There will be a lot of typing and repletions. Linux offers the history command to tackle with this situation. Shell configuration is done through a few system files and a few user files. Environment variables are like variables in programming languages. In bash you set the variables by using export command, then you can view the value of the variable with echo command or view all the variables with env command.

Linux provides a text based help system known as man. you can type man man to get more information.

Streams, Redirection, and Pipes and some of the most powerful command-line tools in Linux.

File combining tools come in handy when working with text or sound files. cat | join | tee.

You can merge files many different ways. One very crude way is to use a command called paste.

There are commands to transform a file into what we would like to see. These commands are expand | od | sort | split | tr | unexpand | uniq | tac.

File Formatting tools come in handy when you have difficult files to work with. Files that has long lines and bad formatting. Here are some tools you will need to fix those files fmt | nl | pr | lpr

Regular Expressions are used is many commands and it is best to know how they work and how they are constructed.

To view logs theer are a few commands that make things easy. head | tail | less | more

File Summarizing commands are best to extract only the information you are interested it, thus saving time not looking at the whole file. These tools are cut | wc | grep | sed

If you do want to view files the one editor that is on all unix systems is vi.

For security reasons it is best to keep an eye on your processes and system. To do this use ps and top.

If you are in a shell you may want to suspend a process or put it in the background so you can have a free terminal to run new processes. To achieve this use fg | bg | jobs and nohup | nice | renice.

If you have a run away process you can use kill to get rid of it.

Managing Software

There are many ways to install software on linux systems. The oldest way is to get the source and compile the program yourself, creating the binary files and library file. Over the years there has been a need to standardize the installs and also keep record of installed software for easy uninstall and upgrade. We need to understand Package Concepts and then the package systems. There are 3 main ways on installing software on your linux system.

Configuring Hardware

Managing Files and Filesystems

X Windows System

Personal tools