All rights reserved, please indicate the source when citing
Get to know Linux
1.0 The Story of UNIX/Linux
UNIX
GNU
Linux
1.1 The Attitude of Learning Linux
1.2 Linux Has Entered the Homes of Ordinary People
1.3 Understanding Linux Distributions
Installing Linux/Choosing the Right Learning Environment
Bare Metal Installation
Virtual Machine Installation
Utilizing a Hard Drive Enclosure
^ back on top ^
Understanding the Linux Command-Line Interface (CLI)
1.0 Introduction to Shell
Logging into the command-line interface
Superuser (root)
Linux command syntax
Control keys in the CLI
<Ctrl+Alt+F(1~7)> Switching terminals
<↑>, <↓> History search
Reviewing command history with the "history" command
<!> Specifying command numbe
<Ctrl+C> Stopping current operation
<Ctrl+D> Logging out or ending a file
<Tab> Autocompletion
<Ctrl+R> History search + autocompletion
Input Control
<Ctrl+U> Deleting the entire line
<Ctrl+W> Deleting input before the cursor
<Ctrl+K> Deleting input after the cursorr
<Ctrl+L> Clearing the screen above the cursor
1.1 Logging out
logout : Log out
exit : Exit the current shell
su : Temporarily change user
1.2 Shutdown
poweroff : Shut down
halt : Shut down
reboot : Restart
shutdown : Shut down
sync : Synchronize buffer memory and hard disk
runlevel : Check the current run leve
init : Execute run level
1.3 Clearing the screen
clear : Clear the screen
reset : Reset the screen
1.4 Auxiliary documentation
man : Command manuall
info : Command manuall
--help : Command's built-in help
^ back on top ^
1.0 Directories and Paths in Linux
Directory Operations
pwd : Display working directory
tree : Display directory tree
cd : Change directory
Absolute paths
Relative paths
mkdir : Create directory
/tmp directory
rmdir: Remove directory
1.1 File-related Commands
file : Identify file type
ls : List files
File Types
Linux Timestamps
atime
ctime
mtime
alias : Command alias
stat : Display file attributes
1.2 File Retrieval
cat: Read file
head : Read the beginning of a file
tail : Read the end of a file
tac : Reverse read
od : Octal output
Nnewline
unix2dos : UNIX to DOS format
dos2unix : DOS to UNIX format
echo : Display text
more : Paging file viewer (scroll down)
less : Paging file viewer (scroll up/down)
^ back on top ^
Pipes/Redirections
1.0 Pipes & Redirections
Pipes
Redirections
"1>" or ">" : Standard Output Redirection
"1>>" or ">>" : Standard Output Append Redirection
"2>" : Standard Error Output Redirect
/dev/null : Bottomless pit
"2>>" : STDERR Append Redirection
"0<" or "<" : Standard Input (STDIN) Redirection
"-" : STDIN
"2>&1" or &>" : STDERR Redirects STDOUT
"1>&2" : ST DOUT Redirected STDERR
"<< Delimmiter" : End Input
tee T-Shaped Pipeline
1.1 Instruction Return Value & Instruction Execution Flow
"&&" : Return Value is 0 Execute
"||" : Return Value Execute for ≠0
^ back on top ^
File Operations
Basic File Operations
Link Files
Symbolic Link
Hard Link
ln : Create File Link
cp : File Copy
rm : File Delete
mv : File Move
"\ " : Escape Character
^ back on top ^
Linux Wildcards
1.0 Wildcards
"?" : Matches any single character
"*" : Matches zero or more characters of any length
"{PATTERN 1,PATTEN 2,..,PAATER n}" : Expands to multiple patterns
"[ ]" : Specifies a character set to match against
"[ - ]" : Specifies a range of characters to match
"[^ ]" or "[!]" : Performs negation or inverse matching
POSIX Character
1.1 rename : Renaming Multiple Files
^ back on top ^
File Ownership and Permissions
1.0 File Owners and Permissions
Ownership
Permissions
Directory Permissions
Special Permissions
Sticky Bit
SGID (Set Group ID bit)
SUID (Set User ID Bit)
chmod : Change File Permissions
Numeric Mode
Symbolic Mode
Link File Permissions
umask: Change Default File Permissions
1.1 File Attributes
chattr : Change File Attributes
lsattr : Display File Attributes
^ back on top ^
vi Editor
1.0 Understanding vi
Basic operations in vi
Modes of operation in vi
1.1 Normal Mode
Arrow keys
Quick cursor movement
Bookmarks
Scrolling
Replace a character
Deletion
Joining lines
Indentation
Searching
Copying/Pasting
Undo
Repeat the previous action
Save and exit vi
1.2 Insert Mode
1.3 Command Mode
Introduction to ex line editor
Line editing
Deleting, copying, and moving
Saving, exiting
Searching
Replacing
Executing Shell Commands
Deleting bookmarks
1.4 Editing multiple files
Loading files
Switching between files
1.5 Visual Block Mode
1.6 Split windows
1.7 Environment configuration
1.8 nput control characters and arbitrary characters
^ back on top ^
File Compression
1.0 Introduction to File Compression
1.1 Common Compressed File Formats
gz Files
gzip : Compress/Decompress .gz files
gunzip : Decompress gz files
zcat : Read gz Compressed files
.bz2 Files
bzip2 : Compress/Decompress .bz2 files
bunzip2 : Decompress .bz2 files
bzcat : Reads bz2 compressed files
bzip2recover : Recovers data from damaged bz2 files
.xz Files
xz : Compress/Decompress .xz files
unxz Decompress xz files
xzcat: Read xz Compressed filess
.Z Files
compress Compress/Decompress .Z files
uncompress Decompress .Z files
.zip files
zip : Compress files into zip format
unzip : Decompress zip files
zipinfo : Lists information about zip files
1.2 File Archiving
.tar Files
tarball A Compressed tar Files
tar : Archives/Extracts files from a tar file
tar bomb
^ back on top ^
File Search in Linux
File Search
type : Display command type
which : Find executable files
whereis : Find files in default paths
llocate : Search through on the hard drive
updatedb : Update the database of indexed files
find: The ultimate file search tool
ENG⇒中ENG⇒中
Account Management
1.0 Account Management
Understanding account-related configuration files
/etc/passwd
/etc/shadow
passwd : Changing passwords
useradd : Adding an account
useradel : Deleting an account
vipw : Modifying /etc/passwd
usermod : Modifying an account
1.1 Personal Account Modification
chfn : Change finger command display information
chsh : Change login shell
finge r: Querying an account
1.2 Other Account-related Commands
id : Displaying account ID
who/w : Displaying logged-in user information
lastlog : Account login query
^ back on top ^
Group Management
1.0 Group Management
/etc/group
/etc/gshadow
groupadd : Create a new group
vigr : Edit /etc/group
groups : List the groups a user belongs to
newgrp : Switch to a different group
gpasswd : Set group password and manage members
groupmod : Modify a group
groupdel : Delete a group
1.1 Collaborative Group Work
chgrp : Change the group ownership of a file
chown : Change File Ownership
^ back on top ^
sudo
1.0 sudo : Standing on the Shoulders of Giants
visudo : Modify /etc/sudoers
/etc/sudoers : Configuration File
Alias : Alias Settings
TAG : Tag Settings
sudo : Examples of Usage
^ back on top ^
Regular Expressions
1.0 Introduction to Regular Expressions
1.1 Basic Regular Expressions (RE/BRE)
Bracket Expressions (POSIX bracket notation)
POSIX Characters
. : Match any single character
* : Characters before matching are repeated from zero to infinite
^ : Match the string at the start position
$ : Match the string at the end position
& : Remember the matched string
{a, b} : Match the character before the repetition
( ) : Set the string before the match
< > : Match the single word
( )\1 : Backward reference memory match
| : Or match
1.2 Extended Regular Expressions (ERE)
| : Or match
+ : Match the previous one to infinite repeated characters
? : Match the previous zero to one repeated characters
^ back on top ^
Linux Filtering Programs
Filter Introduction
grepgrep Search for a string in a file
egrep
frgep
cut : Extract fields
col : Filter control characters
tr : Character translation
sort : Sort lines
uniq : Remove adjacent duplicate lines
^ back on top ^
sed
1.0 Introduction to sed
1.1 File String Modification with sed
Basic Usage of sed
Advanced Usage of sed
delimiter
ADDRESS Range
OPTION
FLAG
Flow Control
COMMAND
^ back on top ^
awk
Processing text-based data with awk
Basic usage of awk
Awk program patterns
User-defined variables
Built-in variables
BEGIN and END blocks
Output functions print and printf
Associative arrays
Executing system commands using system
Closing files/pipelines using close
Reading input data using getline
Mathematical functions
String functions
User-defined functions(UDFs)
^ back on top ^
Disk Proficiency in Linux
1.0 Hard Disk and File System Directory Structure in Linux
Linux Filesystem
ext2 File Systemext2 File System
ext3/ext4 File System
Unix Directory Structure
Hard Disks and Device Files in Linux
1.1 Displaying Hard Disk Information
df : Display disk usage
du : Display directory usage
blkid : Display disk information
1.2 Disk Partitioning
Traditional MBR Disk Partitioning
Primary Partition
Extended Partition
Logical Partition
Using fdisk to partition disks
Modern GPT Disk Partitioning
Using parted to partition disks
partprobe : Reload Partition Table
1.3 Formatting File Systems
mkfs : Format the filesystem
tune2fs : Adjust ext filesystem settings
e2label : Set the label of a filesystem
fsck : Check and attempt to repair the filesystem
1.4 Mounting Filesystems
Basic usage of mount
/etc/mtab : File containing the currently mounted filesystems
Mounting by Label
Mounting by UUID/PARTUUID
Mounting USB Flash Drives
Mounting a CD-ROM
Configuring Automatic Mounting at Boot using /etc/fstab
umount : Unmounting filesystems
Mounting Virtual Device
LVM Logical Volumes
1.0 LVM Logical Volumes
LVM Principles
pvcreate : Creating Physical Volumes
vgcreate : Creating Volume Groups
lvcreate : Creating Logical Volumes
Linear Volume Mode
Stripe Volume Mode
Mirror Volume Mode
Snapshot Volume Mode
LVM Migration/Backup
^ back on top ^
RAID
1.0 RAID - Redundant Array of Inexpensive Disksy
Hardware-RAID
Software RAID
Semi-Hardware-RAID
Choosing RAID Hard Drives
RAID Levels
RAID 0 (stripe)
RAID 1 (mirror)
RAID Downgrading
Spare Disk, Reserve Drive
RAID 5
Unrecoverable Errors in RAID 5
RAID 6
Hybrid RAID
1.1 Linux Software RAID
mdadm : Creating/Managing Software RAID
Create Mode, Establishing Software RAID
Editing RAID Configuration File /etc/mdadm.conf
Monitoring Soft RAID in /proc/mdstat
Manage Mode, Managing Software RAID
Assemble Mode, Restarting Previously Created RAID
Monitor Mode, Monitoring Software RAID
Grow Mode, Changing RAID Size
Miscellaneous Mode
Generic Mode
Creating Hybrid RAID Using mdadm
^ back on top ^
Process
1.0 Introduction to Processes & Jobs
1.1 job
job control
Foreground Program
Terminating a Program <CTRL+C>
Pausing a Program <CTRL+Z>
Background Execution with &
jobs : Display Background Jobs
Managing Jobs
bg : Resuming Suspended Jobs in the Background
fg : Bringing Jobs to the Foreground
kill : Terminate Process
killall : Massacre Processes
1.2 process
PID (Process ID)
Parent Process and PPID
Child Processes
pstree : Display Process Relationship Tree
Process Group & PGID
Process Group Leader
Session and SID
session leader
init : Ancestral Process
Zombie Processes
fork and exec
exec
Daemon
1.3 Process Monitoring
ps : Display Process Status
top : Process and Performance Monitoring
nice : Adjust Process Priority
renice
1.4 Named Pipe (FIFO)
mkfifo
1.5 Process Substitution
^ back on top ^
Advanced Format Hard Drive
1.0 Advanced Format Hard Drive
512e Emulation of Traditional Format Hard Drive
4Kn Native 4K Sector Hard Drive
Partition Alignment for Advanced Format Hard Drive
Identifying Advanced Format Hard Drive
1.1 Partitioning Advanced Format Hard Drive
Automatic Alignment Partitioning with parted
Manual Alignment Partitioning with parted
Partitioning with Windows
^ back on top ^
File descriptor
1.0 Introduction to File Descriptors
File descriptors (fd) and redirection
Directory "/proc/<PID>/fd" and file descriptors
1.1 exec and fd Redirection
exec X>FILE : Redirect fd X to a file
exec X>&Y : Redirect fd X to fd Y
exec X<FILE : Redirect a file to fd X
exec X<&Y : Redirect fd Y to fd X
exec fd X<>FILE : Redirect file to fd X for both reading and writing
X>&- or X<&- : Close fd X
1.2 Who Stole stdin?
^ back on top ^
Virtual block device
1.0 Virtual Block Device
dd : Physical to virtual conversion
losetup : Virtual to physical conversion
kpartx : Mapping partitions in disk images to loop devices
1.1 Swap : Auxiliary Memory
swap-partition
swapon : Enabling swap
swapoff : Disabling swap
swap-file : Using a file for swap
mkswap : Formatting swap
swappiness : Adjusting the aggressiveness of swap usage
^ back on top ^
Managing User and Group Quotas in Linux
1.0 File Capacity Quotas
quotacheck : Create Quota Database
edquota : Edit Quotas
quota : Display User/Group Quotas
repquota : Summarize File System Quota
quotaon : Enable Quotas
quotaoff : Disable Quotas
^ back on top ^