Unix-like
Table of Contents
Tutorials
How-to
- Apply
set -xfor a line - Change hostname
- Config swap spaces/files
- Create a debian pacakge
- Delete all broken symbolic links
- Empty the contents of a file
- Exclude a directory in
find - Find and delete empty directories
- Force exit code 0 in spite of error
- Get the source directory
- Glob dotfiles
- Install
java8withapt-get - Iterate array elements
- Join array elements
- Kill all background processes when the shell script exits
- Mount a Volume
- Pipe
stderr, and notstdout? - Prevent partially downloaded scripts from executing
- Prompt a user for yes/no
- Sort an IP address list using
sortcommand - Sort, uniquify, and other operations on file content
- Temporarily move to a different working directory via subshell
- Test whether a command exists
- Trim a variable
- Use command output as a file
- Use
psonly on specific processes(-o) - Wait until a port available
Discussions
$@or$*- Debian vs Ubuntu
- Does file modification time affect directory modification time?
- Escaping quotes
- Exit status of
curl - How
findworks - Inode Structure
- NUMA(Non-uniform memory access)
- Relative source path of symlink
- Subtlety of Following Symlinks
- Usage of dash (
-) in place of a filename, likecat - - What do
buffersandcachedstand for infreeoutput? aptvsapt-getfind -exec \;vsfind -exec +
Reference
.debfiles/etc/fstab<package>.postinst- Arithmetic Expansion(
$(( expression ))) - Arrays
- Brace Expansion(
a{d,c,b}e, …) - Filename Expansion(or blobs)
- Here document
- Here strings
- History Expansion(
!ps, …) - Linux Performance Tools
- Process Substitution(
<(commmand),>(command)) - Redirection(
>,>>,2>, …) - Shebang(
#!/usr/bin) - Shell Parameter Expansion(
${parameter:-word}, …) - Special Parameters (
$#,$$,$*,$@, …) apt-get updatecasecommanddatedch(debchange)declaredpkgduexportfindforfreefunctiongrepheadifiostatkilllsblklsofmkfsmkswapmktempmountpgreppkillreadonlysetsortsutarteetoptrapwatch
Index
- Built-in Commands builtin/
- Debian debian/
- Linux linux/
- Piping and Redirection pipe/
- Search Tools search-tools/
- Shell Expansions expansions/
- Shell Language Syntax lang/
- Shell Snippets snippets/
- apt-get apt/
- curl curl/
- date date/
- du du/
- find find/
- free free/
- grep grep/
- head head/
- iostat iostat/
- kill kill/
- ln ln/
- lsof lsof/
- mktemp mktemp/
- mount mount/
- pgrep pgrep/
- pkill pkill/
- ps ps/
- sort sort/
- su su/
- tar tar/
- tee tee/
- top top/
- watch watch/