• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/173

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

173 Cards in this Set

  • Front
  • Back

Definition: Shell

A program that takes keyboard commands and passes them to the operating system to carry out

Definition: Bash

Bourne Again SHell, an enhanced replacement for sh (the original Unix shell program written by Steve Bourne)

Definition: Terminal Emulator

Required to provide the graphical user interface with the capacity of interacting with the shell

Definition: Shell prompt

Appears whenever the shell is ready to accept input

Tip: Shell Prompt - $ vs. #

Seen as the last character of the shell prompt, # denotes that the terminal session has superuser privileges

Definition: Command history

Pressing up-arrow key in the terminal will bring up the previously typed commands, generally up to 500

Definition: Cursor

Flashing character in the text, navigate using left and right arrow keys

Command: date

Displays the current time and date

Command: cal

By default, displays a calendar of the current month

Tip: How to copy and paste

Left click mouse and drag through text, middle mouse button to paste

Command: df

Shows the current amount of free space on your disk drives

Command: free

Display the amount of free memory

Command: exit

Ends a terminal session

Command: pwd

Print name of the current working directory

Command: cd

Change directory

Command: ls

List directory contents

Definition: Hierarchical directory structure

Organized in a tree like pattern of directories (folders in other systems)

Definition: Root directory

First directory in the file system

Definition: Parent directory

Directory above the current directory

Definition: Sub-directories

Directories below the current directory

Definition: Absolute pathname

Begins with the root directory and follows the tree, branch by branch, until the the desired directory or file is reached

Definition: Relative pathname

Starts from the current working directory and leads to its destination

Relative Pathname: .

Refers to the current working directory

Relative Pathname: ..

Refers to the working directory's parent directory

cd -

Changes to working directory to the previous working directory

cd ~username

Changes to the home directory of the current user

Command: file

Determine the file type

Command: less

View file contents

ls: -a

List all files, even hidden files (have a period at the beginning of the filename)

ls: -d

See details about a directory

ls: -F

Append an indicator character to the end of each listed name (such as a \ for directory)

ls: -h

Display file sizes in human-readable format rather than in bytes

ls: -l

Display results in long format

ls: -r

Display results in reverse order

ls: -S

Sort results by file size

ls: -t

Sort results by modification time

less: b

Scroll back one page

less: spacebar

Scroll forward one page

less: up arrow key

Scroll up one line

less: down arrow key

Scroll down one line

less: G

Move to the end of the text file

less: g

Move to the beginning of the text file

less: \[characters]

Search forward for the next occurrence of "characters"

less: n

Search for the next occurrence of the previous search

less: h

Display help screen

less: q

Quit less

Directory: /

Root directory

Directory: /bin

Contains binaries (programs) that must be present for the system to boot and run

Directory: /boot

Contains the Linux kernel, initial RAM disk image (for drivers needed at boot time), and the boot loader

Directory: /dev

Contains device nodes, where the kernel maintains a list of all devices that it understands

Directory: /etc

Contains all of the system-wide configuration files and shell scripts that start each of the system services at boot time

Directory: /home

Directory that contains sub-directories for each user

Directory: /lib

Contains shared library files used by the core system programs, similar to DLLs in Windows

Directory: /lost+found

Each formatted partition using a Linux filesystem will have this directory, used in the case of a partial recovery from a filesystem corruption. Generally empty.

Directory: /media

Contains the mount points for removable media that are mounted automatically on insertion

Directory: /mnt

Contains mount points for removable media that have been mounted manually

Directory: /opt

Used to install optional software, such as commercial products installed on a system

Directory: /proc

Virtual filesystem maintained by the Linux kernel, contains readable files that give an understanding of how the kernel views your computer

Directory: /root

Home directory for the root account

Directory: /sbin

Contains system binaries, puritan's that perform vital system tasks that are generally reserved for the superuser

Directory: /tmp

Storage for temporary files created by various programs

Directory: /usr

Contains all the files and programs and support files used by regular users

Directory: /usr/bin

Contains executable programs installed by your Linux distribution

Directory: /usr/lib

The shared libraries for programs contained in /usr/bin

Directory: /usr/local

Contains programs not installed by your distribution but are intended for system-wide use

Directory: /usr/sbin

Contains more system administration programs

Directory: /usr/share

Contains all the shared data used by programs in /usr/bin, such as icons, configuration files, system sound files, etc.

Directory: /usr/share/doc

Contains documentation organized by package

Directory: /var

Where data that is likely to change is stored

Directory: /var/log

Contains log files of various system activities, especially /var/log/messages

Definition: Symbolic link

File pointing to another file, similar to a shortcut. Often used in programming as the symbolic link can be replaced by a new symbolic link with the same name, but referencing a newer file version (e.g. foo -> foo 2.6, replaced by foo -> foo 2.7). Also called soft links and sym links.

Command: cp

Copy files and directories, (e.g. cp item... directory)

Command: mv

Move/rename files and directories, (e.g. mv item... directory)

Command: mkdir

Create directories, (e.g. mkdir directory...)

Command: rm

Remove files and directories, (e.g. rm item...)

Command: ln

Create hard and symbolic links

Wildcard: *

Any characters

Wildcard: ?

Any single character

Wildcard: [characters]

Any character that is a member of the set listed in characters

Wildcard: [!characters]

Any characters that is not a member of the set of characters

Wildcard: [[:class:]]

Any character that is a member of the specified class (almun, alpha, digit, lower, upper)

Long listing (1): -rw-r--r--


Example: -rw-r--r-- 1 root root 159744 2007-04-03 11:05 test.doc

Access rights to the file. The first character indicates thetype of file. Among the different types, a leading dashmeans a regular file, while a “d” indicates a directory.The next three characters are the access rights for thefile's owner, the next three are for members of the file'sgroup, and the final three are for everyone else.

Long listing (2): 1


Example: -rw-r--r-- 1 root root 159744 2007-04-03 11:05 test.doc

File's number of hard links.

Long listing (3): root


Example: -rw-r--r-- 1 root root 159744 2007-04-03 11:05 test.doc

The user name of the file's owner.

Long listing (4): root


Example: -rw-r--r-- 1 root root 15974 2007-04-03 11:05 test.doc

The name of the group which owns the file.

Long Listing (5): 15974


Example: -rw-r--r-- 1 root root 15974 2007-04-03 11:05 test.doc

Size of the file in bytes.

Long Listing (6): 2007-04-03 11:05


Example: -rw-r--r-- 1 root root 15974 2007-04-03 11:05 test.doc

Date and time of the file's last modification.

Long Listing (7): test.doc


Example: -rw-r--r-- 1 root root 15974 2007-04-03 11:05 test.doc

Name of the file.

cp: -a

Copy the files and directories and all of their attributes,including ownerships and permissions. Normally,copies take on the default attributes of the userperforming the copy.

cp: -i

Before overwriting an existing file, prompt the user forconfirmation. If this option is not specified, cp willsilently overwrite files.

cp: -r

Recursively copy directories and their contents. Thisoption (or the -a option) is required when copyingdirectories.

cp: -u

When copying files from one directory to another, onlycopy files that either don't exist, or are newer than theexisting corresponding files, in the destinationdirectory.

cp: -v

Display informative messages as the copy isperformed.

mv: -i

Before overwriting an existing file, prompt the user forconfirmation. If this option is not specified, mv willsilently overwrite files.

mv: -u

When moving files from one directory to another, onlymove files that either don't exist, or are newer than theexisting corresponding files in the destinationdirectory.

mv: -v

Display informative messages as the move is performed

rm: -i

Before deleting an existing file, prompt the user forconfirmation. If this option is not specified, rm willsilently delete files.

rm: -r

Recursively delete directories. This means that if adirectory being deleted has subdirectories, delete themtoo. To delete a directory, this option must bespecified.

rm: -f

Ignore nonexistent files and do not prompt. Thisoverrides the -i option.

rm: -v

Display informative messages as the deletion isperformed.

Tip: rm vs. trashcan

Unix-like operating systems such as Linux do not have an undelete command.Once you delete something with rm, it's gone. Linux assumes you're smart andyou know what you're doing.Be particularly careful with wildcards.




Example: Deleting all of the html files in a directory would be "rm *.html"


However, "rm * .html" will delete all the files in the directory and then complain thatthere is no file called “.html”.




With wildcards, you can also test the return with ls.

Hard Links

Create an additional directory entry for a file




Limitations


1. Cannot reference a file outside its own file system (not on the same disk partition as the link itself)


2. May not reference a directory.

Definition: Symbolic Links

A special type of file that contains a text pointer to the referenced file ordirectory, similar to a Windows shortcut. A file pointed to by a symbolic link, and the symbolic link itself are largelyindistinguishable from one another, besides deletion.

Definition: Inode

Numbered connection between data and name, hard links are additional names that refer to the same inode and therefore the same days. Shown with -i.

ls: -i

Show inode number, generally -li and useful for hard links

ln: -s

Create a symbolic link

Symbolic links: relative pathname vs absolute pathname

Relative pathnames are preferred, as directories can be moved without breaking the link

Command: type

Indicate how a command name is interpreted, (e.g. type [command])

Definition: command

1. An executable program, either compiled binaries (C and C++) or programs written in scripting languages (Perl, Python, Ruby, etc.)


2. Shell built-in


3. Shell function, miniature shell scripts incorporated into the environment


4. An alias, command we define built on other commands

Command: which

Displays which executable program will be executed, used in the case where there is more than one version of an executable. Does not work for builtins or aliases, basically substitutes fire actual executables.

Command: help

Provides info for shell builtins, (e.g. help [command])

Command option: --help

Many executables support this as an option to display a description of the commands supported syntax and options

Command: man

Most executables include a formal piece of documentation, a manual

Tips: Man page organization

1. User command


2. Programming interfaces fire kernel system calls


3. Programming interfaces to the C library


4. Special files such as device nodes and drivers


5. File formats


6. Games and amusements


8. System administration commands

Command: apropos

Display a list of appropriate commands, based on a search term, (e.g. apropos floppy). Identical to man -k.

Command: info

Display a command's info entry, GNU alternative to the man page for their programs that uses it's own reader program and includes hyperlinks (identified by leading asterisk, hover and press enter).

Command: whatis

Displays a very brief description of a command, generally a one line-description of the man page, (e.g. whatis ls)

Command: alias

Create an alias for a command, (e.g. alias name='string'). Using alias by itself will show you all of the current aliases.

Info: ?

Display command help

Info: PgUp or Backspace

Display previous page

Info: PgDn or Space

Display next page

Info: n

Display the next node

Info: p

Display the previous node

Info: u

Display the parent node of the currently displayed node

Info: Enter

Follow the hyperlink at the cursor location

Info: q

Quit

Definition: coreutils

GNU project package of programs. Typing "info coreutils" will display a main page with hyperlinks

Tip: Product Documentation

Many software packages installed on your system have documentation files residing in the usr/share/doc directory

Tip: .gz and zless

.gz is a compressed gzip file. The gzip package includes a version of less called zless that with let you read gzip compressed text files.

Tip: Multiple commands

It's possible to perform multiple commands in a row by separating each command with a semicolon, (e.g. command1; command2; command3; etc. or cd example; ls; cd -)

Tip: Check for used alias

To see if an alias is already assigned, use the type command.

Command: unalias

Remove an alias, (e.g. unalias foo)

Tip: Limitation of defining aliases on the command line

Aliases will be erased when the terminal session is ended. To have them saved, you need to add the alias to the proper files.

Definition: I/O

Input / Output

Command: cat

Concatenate files, generally used for short text files or to join text files together (e.g. cat movie.mpeg.0* > movie.mpeg)

Command: sort

Sort lines of text

Command: uniq

Report or omit repeated lines

Command: grep

Print lines matching a pattern

Command: wc

Print newline, word, and byte counts for each file

Command: head

Output the first part of a file; 10 lines by default, but can be adjusted with -n (e.g. head -n 5 ls-output.txt); Can also be used in pipelines

Command: tail

Output the last part of a file; 10 lines by default, but can be adjusted with -n (e.g. tail -n 5 ls-output.txt); Can also be used in pipelines

Command: tee

Read from standard input and write to standard output files, (e.g. "ls /usr/bin | tee ls.txt | grep zip" will output the entier listing to the ls.txt file before performing the grep filter)

Definition: standard ouput

Results of the command line are sent to stdout. Generally not actually saved into a disk file; 1>

Definition: standard error

Errors from the command line are sent to stderr. Generally not actually saved into a disk file; 2>

Definition: standard input

stdin, is attached to the keyboard by default, and routed as input to certain programs; 0>

Definition: I/O redirection

Allows the user to change where the output goes and where the input comes from. Normally, input comes from the keyboard and output goes to the screen. Basic redirection operator is ">", (e.g. ls -l /usr/bin > ls-output.txt)

Tip: Truncate a text file

Using no command before the redirection operator (>) will empty a text file, (e.g. > ls-output.txt)

Redirection operator: >

Overwrite/empty redirection operator

Redirection operator: >>

Append redirection operator

Redirection operator: 2>

Used for standard error (e.g. ls -l /bin/user/ 2> ls-error.txt)

Redirection operator: 2>&1

Added to the end of an output redirection to also redirect stderr to stdout, thereby capturing both (e.g. ls -l /bin/usr > ls-output.txt 2>&1).

Redirection operator: &>

Modern way to redirect both stdout and stderr to the same file

Tip: How to redirect and hide unwanted output and errors

Redirect to a bit bucket, which accepts input and does nothing with it; (e.g. ls -l /bin/usr 2> /dev/null)

Cat: ctrl+d

Command to tell cat that it has reached the end of file (EoF)

Redirection operator: <

Changes the source of stdin, (e.g. cat < lazy_dog.txt)

Pipe operator: |

Causes the stdout of one command to be pipped into the stdin of another (e.g ls -l /usr/bin | less)

Filter: sort

Sort (and combine if multiple directories) files (e.g. ls /bin /usr/bin | sort | less)

Filter: uniq

Remove duplicates from the list, often used with sort, (e.g. ls /bin /usr/bin | sort | uniq | less)

uniq: -d

Show only duplicate instances instead of unique instances, (e.g. ls /bin /usr/bin | sort | uniq -d | less)

Command: wc

Word count displays the number of lines words and bytes contained in each file, (e.g. wc ls-output.txt)

wc: -l

Only display line count, often used with sort to determine the number of individual items listed, (e.g. ls /bin /usr/bin | sort | uniq | wc -l)

Command: grep

Used to find text patterns within files, (e.g. ls /bin /usr/bin | sort | uniq | grep zip)

grep: -i

Ignore case

grep: -v

only print lines without the pattern

head/tail: -n

Adjust the number of lines to be output (e.g. -n 5)

Command: echo

Display a line of text, causes the shell to print out its text arguments on standard output

Definition: Expansion

The process that converts input into something that the shell can act upon (e.g. * is expanded to the files in the current working directory)

Definition: Pathname expansion

The mechanism by which wildcards work

Tip: Pathname expansion of hidden files

echo .* will show names with "." and ".." and since ".." refers to the relative pathnames of files in the parent directory, your result will be incorrect




ls -d .[!.]?* would show any file starting with a ".", not followed by a subsequent ".", at least one other character, and finally followed by any number of characters

Definition: Tilde expansion

Expands into the home directory of the named user or, if no name is specified, the current user

Definition: Arithmetic expansion

The shell can perform arithmetic using expansion, $((expression)); only supports integers and allows for nesting; e.g. echo $(((5**2) * 3))

Tip: Arithmetic expansion / vs %

% is called the modulo, which will show remainders of division

Definition: Brace Expansion

Allows you to create multiple text strings from a pattern containing braces




Example:


$ echo Front-{A,B,C}-Back


Front-A-Back Front-B-Back Front-C-Back