FIND YOUR NEXT FEW LINES

The snippet library.

Small, practical examples. Search by task or narrow things down below.

125 snippets foundClear filters
Linux CommandsGetting Started

Create an empty practice file

Linux Commands: Create an empty practice file using GNU/Linux commands in an empty practice directory.

Linux Commands✓ Tested
Linux CommandsFiles & permissions

Create private files with a restrictive umask

Linux Commands: Apply umask in a subshell so the surrounding shell is unaffected.

Linux Commands✓ Tested
Linux CommandsStreams & byte tools

Encode and decode a file with Base64

Linux Commands: Use GNU base64 for text transport of bytes and --decode for the reverse operation.

Linux Commands✓ Tested
Linux CommandsGetting Started

Enter and leave a practice directory

Linux Commands: Enter and leave a practice directory using GNU/Linux commands in an empty practice directory.

Linux Commands✓ Tested
Linux CommandsFinding & selecting files

Exclude a directory from a recursive search

Linux Commands: Use prune to avoid descending into generated dependencies.

Linux Commands✓ Tested
Linux CommandsArchive integrity & packaging

Exclude generated files from an archive

Linux Commands: Place exclude options before the input paths to control archive membership.

Linux Commands✓ Tested
Linux CommandsSearching text

Exclude matching lines

Linux Commands: Use grep -v to retain lines that do not start with a comment marker.

Linux Commands✓ Tested
Linux CommandsArchives & checksums

Extract a compressed tar archive

Extract a trusted gzip-compressed tar archive into a dedicated destination directory.

tar✓ Tested
Linux CommandsTransforming text

Extract a delimited text column

Linux Commands: Use cut for simple unquoted delimiter-separated text.

Linux Commands✓ Tested
Linux CommandsGetting Started

Extract a field from simple delimited text

Linux Commands: Extract a field from simple delimited text using GNU/Linux commands in an empty practice directory.

Linux Commands✓ Tested
Linux CommandsFinding & selecting files

Extract a filename from a path

Linux Commands: Use basename with an explicit suffix when removing a known extension.

Linux Commands✓ Tested
Linux CommandsFinding & selecting files

Extract a parent directory from a path

Linux Commands: Use dirname without needing the path to exist.

Linux Commands✓ Tested