- : enable the option
+ : disable the option
Example:
set -o errexit
equals to
set -e
Control operators:
& && ( ) \n ;; ; | ||
Redirection operators:
< > << >> <> <& >& <<- >|
Single Quotes: preserve the literal meaning of all the chars except '
Double Quotes: preserve the literal meaning of all the chars except $ ` \
Backslash: preserve the literal meaning of all the chars except \n
Reserved Words:
! { } case do done elif else esac fi for if then until while
Aliases:
Commands:
Simple Commands Order:
Leading words name=value; Word Expansions; Redirection
Redirections:
[n]> file
[n]>| file
[n]>> file
[n]< file
[n]<> file
[n]<&n2
[n1]<&-
[n1]>&n2
[n]>&-
Search and Execution:
shell functions,
built-in commands,
normal programs
Path Search for normal programs:
shell function, built-in, then PATH
Command Exit Status:
zero succeed
non-zero failure
128+signo terminated by a signal
Complex Commands:
simple command
pipeline
list or compound-list
compound command
function definition
Pipelines:
[!] command1 [| command2 ...]
Background Commands:
command1 & [command2 & ...]
Lists:
Short-Circuit List Operators:
&& ||
Flow-Control Constructs:
if list
then list
else iist
fi
while list
do list
done
for variable [in word ...]
do list
fone
break [num]
continue [num]
case word in
pattern) list ;;
...
esac
Grouping Commands Together:
(list)
or
{ list; }
Functions
name ( ) command
local variable
return [exit status]
Variables and Parameters:
name=value
Positional Parameters:
$0 $1 ...
Special Parameters:
$*: positional parameters starting from one
$@: positional parameters starting from one
$#: number of positional parameters
$?: the exit status of the most recent pipeline
$-: the current option flags
$$: the process id of the invoked shell
$!: the process ID of the most recent background command
$0: name of the shell or shell script
Word Expansions:
Tilde Expansion, Parameter Expansion, Command Substitution,
Arithmetic Expansion, Quote removal
Tilde Expansion:
~/.tools/list
/usr/name/.tool/list
Parameter Expansion:
${expression}
${parameter:-word} : Use default value
${parameter:=word} : Assign default value
${parameter:?[word]} :Indicate Error if Null or Unset
${parameter:+word} : Use Alternate Value
${#parameter} : string length
${parameter%word} : Remove smallest suffix pattern
${parameter%%word} : Remove largest suffix pattern
${parameter#word} : Remove smallest prefix pattern
${parameter##word} : Remove largest prefix pattern
Command Substitution:
$(command) or
`command`
Arithmetic Expansion:
$((expression))
While Space Splitting:
Pathname Expansion:
Shell Patterns:
! * ? [
*: any string of chars
?: any single char
[: introduce a char class
]: end a char of class
Built-in Commands:
: null cmmand that return a 0 exit value
. file: file is read and excuted
[ : built-in equivalent of test
alias [name[=string] ...] :
bg [job ...': background
builtin cmd: execute the specified built0in command
bind:
cd directory:
chdir:
command [-p]
command [-v]
echo [-e | -n] [string ...]
eval string ...
exec [command [arg ...]]
exit [exitstatus]
export name ...
export [-p]
false
fc [-e editor]
fc -l
fc -s
fg [job]
getopts optstring var
hash [-rv] [command ...]
jobid [job]
jobs [-lps]
local:
pwd [-L | -P]
read [-p prompt] [-t timeout] [-er] variable
readonly [-p] [name]
return [exitstatus]
set [-/+abCE..]
setvar variable value
shift [n]
test
times:
trap [action] signal
trap -l
true
type [name ...]
unlimit
unmask
unalias
unset
wait [job]
Tuesday, July 29, 2014
Wednesday, February 26, 2014
Linux Storage Terminology
AFS: Andrew distributed file system
ATA: Advanced Technology Attachment
ATAoE: ATA over Ethernet
BTRFS: Butter FS
CAS: content-addressable storage
Ceph:
CIFS: Common Internet File System
CRC: cyclic redundancy check
DAP: Data Access Protocol
DAS: Direct-attached storage
DIF: data integrity field
exofs:Extended Object File System
ext3: third extended file system
ext4: fourth extended file system
FC: Fibre Channel
FCoE: Fibre Channel over Ethernet
FCS: fixed-content storage
FUSE: Filesystem in Userspace
JFFS2: Journaling Flash File System version 2
GPFS: General Parallel File System
HPC: high-performance computing
IDE: Integrated Drive Electronics
iSCSI: Internet SCSI
ISO: nternational Organization for Standardization
LBA: logical block addressing
LUN: Logical Unit Number
Lustre: Linux clUSTER
LVM: Logical Volume Manage
NAS: Network-attached storage
NFS: Network File System
OSD: Object Storage Device
pNFS: Parallel NFS
RAID: redundant array of independent disks
RDMA: remote direct memory access
RPC: remote procedure call
SAN: Storage area networks
SATA: Serial ATA
SAS: Serial attached SCSI
SCSI: Small Computer System Interface
SMB: Server Message Block
SRP: SCSI RDMA Protocol
SSA: Serial Storage Architecture
SSD: solid-state disk
eSATA: external SATA
UBIFS: Unsorted Block Image File System
UDP: Universal Datagram Protocol
USB: Universal Serial Bus
VFS: virtual file system switch
XDR: external data representation
xHCI: Extensible Host Controller Interface
XIP: Execute-in-place
YAFFS2: Yet Another Flash File System version 2
ZFS: Zettabyte File System
ATA: Advanced Technology Attachment
ATAoE: ATA over Ethernet
BTRFS: Butter FS
CAS: content-addressable storage
Ceph:
CIFS: Common Internet File System
CRC: cyclic redundancy check
DAP: Data Access Protocol
DAS: Direct-attached storage
DIF: data integrity field
exofs:Extended Object File System
ext3: third extended file system
ext4: fourth extended file system
FC: Fibre Channel
FCoE: Fibre Channel over Ethernet
FCS: fixed-content storage
FUSE: Filesystem in Userspace
JFFS2: Journaling Flash File System version 2
GPFS: General Parallel File System
HPC: high-performance computing
IDE: Integrated Drive Electronics
iSCSI: Internet SCSI
ISO: nternational Organization for Standardization
LBA: logical block addressing
LUN: Logical Unit Number
Lustre: Linux clUSTER
LVM: Logical Volume Manage
NAS: Network-attached storage
NFS: Network File System
OSD: Object Storage Device
pNFS: Parallel NFS
RAID: redundant array of independent disks
RDMA: remote direct memory access
RPC: remote procedure call
SAN: Storage area networks
SATA: Serial ATA
SAS: Serial attached SCSI
SCSI: Small Computer System Interface
SMB: Server Message Block
SRP: SCSI RDMA Protocol
SSA: Serial Storage Architecture
SSD: solid-state disk
eSATA: external SATA
UBIFS: Unsorted Block Image File System
UDP: Universal Datagram Protocol
USB: Universal Serial Bus
VFS: virtual file system switch
XDR: external data representation
xHCI: Extensible Host Controller Interface
XIP: Execute-in-place
YAFFS2: Yet Another Flash File System version 2
ZFS: Zettabyte File System
Tuesday, February 25, 2014
GPIO Interrupts Routing in X86
Interrupt routing on X86 is very complicated.
On X86, the 1s 16 GPIO pins can be configured as interrupt.
The routing path for GPIO interrupt is:
GPIO-->ACPI(GPE)-->IRQ9
error gpe02 gpe0A gpe12 gpe1A gpe22 gpe2A gpe32 gpe3A
ff_gbl_lock gpe03 gpe0B gpe13 gpe1B gpe23 gpe2B gpe33 gpe3B
ff_pmtimer gpe04 gpe0C gpe14 gpe1C gpe24 gpe2C gpe34 gpe3C
ff_pwr_btn gpe05 gpe0D gpe15 gpe1D gpe25 gpe2D gpe35 gpe3D
ff_rt_clk gpe06 gpe0E gpe16 gpe1E gpe26 gpe2E gpe36 gpe3E
ff_slp_btn gpe07 gpe0F gpe17 gpe1F gpe27 gpe2F gpe37 gpe3F
gpe00 gpe08 gpe10 gpe18 gpe20 gpe28 gpe30 gpe38 gpe_all
gpe01 gpe09 gpe11 gpe19 gpe21 gpe29 gpe31 gpe39 sci
On X86, the 1s 16 GPIO pins can be configured as interrupt.
The routing path for GPIO interrupt is:
GPIO-->ACPI(GPE)-->IRQ9
Linux# ls /sys/firmware/acpi/interrupts/
error gpe02 gpe0A gpe12 gpe1A gpe22 gpe2A gpe32 gpe3A
ff_gbl_lock gpe03 gpe0B gpe13 gpe1B gpe23 gpe2B gpe33 gpe3B
ff_pmtimer gpe04 gpe0C gpe14 gpe1C gpe24 gpe2C gpe34 gpe3C
ff_pwr_btn gpe05 gpe0D gpe15 gpe1D gpe25 gpe2D gpe35 gpe3D
ff_rt_clk gpe06 gpe0E gpe16 gpe1E gpe26 gpe2E gpe36 gpe3E
ff_slp_btn gpe07 gpe0F gpe17 gpe1F gpe27 gpe2F gpe37 gpe3F
gpe00 gpe08 gpe10 gpe18 gpe20 gpe28 gpe30 gpe38 gpe_all
gpe01 gpe09 gpe11 gpe19 gpe21 gpe29 gpe31 gpe39 sci
Reading Materials:
PCI Interrupts
PCI Interrupts for x86 Machines under FreeBSD
User Space Device Driver
Subscribe to:
Posts (Atom)