EEC Logo

Unix/Linux Command Line Tools

Duration: 3 days

Audience

System and application end-users who have taken an Introduction to Unix/Linux course and have seen the potential available in the command line utilities. This includes application support personnel, database administrators, and 4GL and Java programmers who need a functional familiarity with system tools and commands.

Course Contents

These contents are projected. As development continues this list may change to accommodate time constraints.

  1. Review of Simple Commands

    1. Process listing: ps

    2. Directory listing: ls

    3. File search: find

    4. Extracting text: cut

    5. Printing first or last lines: head / tail

  2. Extended Regular Expressions

    1. As implemented by egrep

    2. As implemented by sed

    3. As implemented by awk

    4. Overview of PCRE (Perl-Compatible Regular Expressions)

  3. Interactive Commands

    1. script (command logging)

    2. screen (multiple concurrent detachable shells)

    3. vim (shell commands within vim, mapping keys, bookmarks, split screen support)

  4. Data manipulation commands

    1. Putting stdin on the command line: xargs

    2. Sorting: sort

    3. Differences between files: diff / sdiff / patch

    4. Common lines: comm

    5. Byte-by-byte comparison: cmp

    6. Splitting one file into many: csplit / split

    7. Formatting files: fmt / fold / nl / pr

    8. Generating number sequences: seq

    9. Filtering unique lines: uniq

    10. Using Perl's pod command for documentation

  5. Administration-related commands

    1. System log access: logger

    2. Checksums: md5sum / shasum

    3. Terminal control: tput

    4. Repetitive execution: watch

    5. Disk space: du / df

    6. PATH searching: env

    7. System configuration: getconf

    8. Programmed interface: expect

  6. Network tools

    1. IO redirection of TCP and UDP in Bash and Korn

    2. Secure shell: ssh / scp / sftp

    3. Syncing two machines: rsync

    4. Raw network connection: netcat

    5. Raw IO control: dd

    6. Downloading: wget / curl / lwp-get / lwp-download

    7. Email message processing: formail

    8. IP address arithmetic: ip

  7. Compression utilities

    1. Oldest LZW: compress / uncompress

    2. GZip: gzip / gunzip / zcat / zmore / zless / zgrep

    3. BZip2: bzip2 / bunzip2 / bzcat / bzmore / bzless / bzgrep

    4. 7-Zip: 7zip / 7unzip

    5. Miscellaneous: zoo / zip / rar / others

  8. Archival/backup commands

    1. BSD archiver: tar / gnutar

    2. SVR4 archiver: cpio

    3. Portable archiver: pax

    4. Windows archiver: zip / unzip / zipinfo

    5. Raw IO control: dd

Course Objectives

Upon completion of this course, the student will be able to create advanced command lines involving I/O redirection and pipes, and create simple automated scripts in bash/ksh. (Sophisticated scripts are the topic of other courses). A sample of the types of problems solved using commands covered by this course:

Instructional Technique

Students are invited to bring their current ideas and questions to the classroom for discussion. Case studies, lecture, group problem solving, and online laboratories will be used. Students will be encouraged to enhance their skills utilizing the techniques presented through classroom problem solving and controlled online workshops.

Prerequisites

Completion of an Introduction to Unix or similar course, and six months of command line experience on a Unix/Unix-like operating system. See below for a quick quiz to determine if you're ready for this fast-paced course.

Quiz

Are you ready for this course? If you can't immediately answer the following questions (no more than five seconds of time to think about the answer!), then you should consider taking an Introduction to Unix course and practicing your command line skills prior to attending this course.

  1. The ls command.

    The ls command normally displays the contents of whatever directory is provided on the command line. What option turns OFF the display of a directory's contents? (So the output would consist of one line of data with a d in column zero.)

  2. The cat command.

    The cat command is normally used to display the contents of a file, but it can also add line numbers to the output, display tabs as ^I characters, add end-of-line markers, and other functions. Name at least two valid option letters to the cat command and describe what they do.

  3. The tail command.

    The tail command is a staple of the Unix environment. It can be executed with the -n option followed by a positive or negative number. What do these numbers represent by default and what is the difference between the plus sign prefix and the minus sign prefix?

  4. Describe what the following command does...

    Describe what the following command does in 25 words or less (you can take 5 seconds for each command in the pipe, and you're allowed to guess at which data is being extracted from the ps output):

    ps -eaf | cut -c56- | tail -n +2 | sort -u

  5. Which of these commands...?

    Which of these command groups produce nonsense output (you get five seconds per command group):

    1. ps -eaf | sort -k 1.56

    2. ls -l /var/spool/at > /tmp/frank | wc -l

    3. echo "%r" > format; date +$(cat format)

    4. echo "%r" > format; var=$(date +$(cat format))

If you didn't get at least three of the above questions correct immediately, you're not ready for this course.

The answers are:

  1. -d

  2. -n/-t/-e/-v and some versions of the cat command have -b and -s

  3. Number of lines.

    A positive number begins counting from the beginning of the file and a negative number counts backwards from the end of the file.

  4. Creates an alphabetical list of command lines running on the system (removing duplicates).

    This assumes that ps -f prints the command line beginning in column 56.

  5. #2