Unix-like
Table of Contents
Tutorials
How-to
- Apply
set -x
for 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
java8
withapt-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
sort
command - 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
ps
only 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
find
works - 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
buffers
andcached
stand for infree
output? apt
vsapt-get
find -exec \;
vsfind -exec +
Reference
.deb
files/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 update
case
command
date
dch
(debchange)declare
dpkg
du
export
find
for
free
function
grep
head
if
iostat
kill
lsblk
lsof
mkfs
mkswap
mktemp
mount
pgrep
pkill
readonly
set
sort
su
tar
tee
top
trap
watch
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/