Linux+ Exam Objective 103.1

Command Line Basics

The command line in Linux is called the Shell. The shell allows a user an interface to the system that accepts commands in the form of text commands. There are many different types of shells and some of them are listed here:

  • bash – aka Bourne Again Shell, most common
  • sh – bash is based on sh and is a pointer to other shells
  • tcsh – based on csh
  • csh – not very popular in linux
  • ksh – Korn shell was designed to take the best features from bash and csh and extend them.
  • zsh – extends ksh and more from earlier shells
  • fish – friendly interactive shell, made to be user friendly

There are two types of default shells:

  • default interactive shell – a user enters commands with this shell
  • default system shell – usually used to run system shell scripts, typically at startup

Exam Essentials

To start a shell the quickest way from a desktop GUI is by pressing CTRL ALT T together.

Features that Linux shells offer to speed up command entry is the history command that lists the commands that have been sent previously. Tab completion lets you finish command line commands by hitting the tab key and finishing the command for you. Command line editing lets you edit a previous command before pressing the enter key.

The man command will display information about commands that you need help with in case you need help formatting a command.

Environment variables hold data that is read by programs and used to modify program behavior.

Standard output carries normal program output. Standard error carries error messages.

The purpose of pipes || is to tie programs together by sending the output from one program to the input of another program. Also used to link a series of simpler programs for more complex output.

Simple filter commands allow you to combine files, transform data in files, format text, display text, and summarize data.

File combining commands:

  • cat first.txt second.txt > combined.txt
  • cat first.txt
  • Data from first
  • cat secont.txt
  • Data from second
  • cat combined.txt
  • Data from first
  • Data from second

cat can also be used to display a text file. The tac command can also reverse the order of the text in the file when it is displayed.

The join command combines two files by matching the contents of fields within the files.

The paste command merges files line by line with a tab for separation.

File transforming commands:

expand command  converts tabs to spaces.

od command displays files in octal, aka an octal dump.

sort sill sort files by case, month, numeric, reverse order or field.

split can split a file into two or more files.

tr command changes individual characters from standard input.

unexpand sets tabs to spaces.

uniq command removes duplicate lines.

There are many more commands that will not be listed, but I think these will be most useful.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close