Command Line and Shell Quick Reference

A quick reference/cheat sheet about various command line and shell related related things. From shell and bash syntax to common command line tools.

Compressed files

tar -xf $FILE

You can add -v in there to print the file names as well.

If you're not dealing with stdin, then it should auto-detect the compression type.

Finding files

locate

To find from current directory:

locate "$PWD*/<FILE GLOB>"

find

Manual: https://www.gnu.org/software/findutils/manual/find.html

find <OPTIONS> <PATH>

Options

Shell/Bash Syntax

diff

Finds difference between two files/directories

Rsync

Useful Options

lsblk

Lists devices. Useful for finding USB drives, other external storage, etc.

Those devices are usually in /dev/

udisk

udisksctl mount -b DEVICE_NAME

udisksctl unmount -b DEVICE_NAME

Where DEVICE_NAME is a device from lsblk.

Automatically mounts a device.