Tips and tricks

This page is a collection of Linux-focused one-liners using open-source tools. The long names of flags are presented for better readability. Tested version of each tool is also documented and can be seen by hovering your mouse over the links.

Containers

💡 Depending on the configuration of your machine and your access level, some of these container tools may not be fully functional!

Build

Build a container from a Dockerfile

Build a container from an Apptainer Definition File

Sign

Generate a keypair for signing container images

Sign a container image

Verify the signature of a container image

Inspect a container image

Inspect container image manifest

Check a container image for known vulnerabilities

Processes

Get process ID

Shows the processes for the current session

Shows the processes for the current user from all sessions

Terminate a process

Terminate a process with a known process ID

Terminate a process with a known process name

Files

Find

Find files and directories by name

Identify

Detect file type

Calculate checksum

Verify integrity

Transfer

Download a file from a web server

Transfer a file between machines with SSH access

Synchronize directories between machines with SSH access

Text files

View content

Search for a string in a file

Replace strings in a file

Sort content line-by-line

Count the number of newlines

Compare two text files

Compare numbers in text files

Concatenate multiple text files

Markdown files

Lint Markdown files

HTML & XML files

Format xHTML files

CSS files

Lint CSS files

JSON files

Format JSON files

Dockerfiles

Check dockerfile for misconfiguration

Archive files

Make an archive

Extract an archive

Source files

C++

Format C++ source files
Find unused includes

Python

Format Python scripts
Find unused Python code
Audit Python scripts for common security issues
Audit Python dependency tree for known vulnerabilities
Find minimum required Python version
Lint python scripts

Fortran

Format Fortran source files

Executable files

Measure runtime

Find shared object dependencies

Git repositories

Initialize a git repository

Clone a git repository

Configure a git repository

Set your name for commits and tags

Set your email for commits and tags

Inspect a git repository

See working tree status

See git commits

See past git operations

Synchronize git repositories

Fetch commits from remote

Copy commits from local branch to remote

Modify a git repository

Add a file to staging area

Commit staged changes

Create a new branch

Change to a different branch