← All lessons
Linux
All Linux snippets · 196
Every snippet has its own focus page with an explanation and the output it produces.
Files & Directories · 16
- Listing files in detail
- Showing hidden files
- Newest files first
- Returning to the previous directory
- Creating nested directories
- Copying a directory
- Trailing slash changes the target
- Preserving attributes
- Renaming a file
- Overwriting without warning
- rm has no undo
- Deleting safely with a prompt
- Creating an empty file
- Inspecting file metadata
- Viewing a directory tree
- Splitting a path
Viewing Files · 9
Permissions & Ownership · 9
Users & Groups · 8
Processes · 13
- Listing processes
- Finding a process by name
- Asking a process to stop
- kill -9 skips cleanup
- Signalling by name and user
- Watching live resource use
- Backgrounding and resuming
- Surviving a disconnect
- Background jobs die with the shell
- Finding what holds a port
- Deleted files still consume disk
- Tracing system calls
- Lowering a job's priority
systemd · 12
Pipes & Redirection · 11
Text Processing · 18
- Searching a file
- Recursive case-insensitive search
- Showing context around matches
- Inverting and counting
- Extended regex
- Substituting text
- In-place edits need -i
- Editing in place with a backup
- Printing a line range
- Selecting a column
- Filtering and summing
- Grouping with an array
- Extracting a delimited field
- Numeric sort
- uniq only collapses adjacent lines
- Translating characters
- Aligning output into columns
- Querying JSON output
Search & Find · 7
Archives & Transfer · 11
Disk & Filesystem · 10
Networking · 12
SSH & Remote · 8
Shell Scripting · 16
- Assigning and expanding
- Unquoted variables split
- Default values
- Testing a file
- String and numeric tests
- Looping over files
- Reading a file line by line
- Defining a function
- Checking the last exit code
- Failing fast in a script
- set -e ignores failures in conditions
- Cleaning up on exit
- Requiring an argument
- Iterating an array safely
- Capturing output
- Linting a script