Skip to content

Shell

AKA prompt command-line command-line-interface cli bash terminal console linux-shell zsh

Bash

https://www.gnu.org/software/bash/manual/bash.html Bash Reference Manual

Variables

How to assign a variable?

export item="something"

echo $item
export item="something"

echo $item

Dates

How to print a formatted date in a command?

now="$(date +'%Y%m%d')"

$(date +%F)
now="$(date +'%Y%m%d')"

$(date +%F)

List contents of a directory sorted by modified timestamp

ls -lt
ls -lt

ls (deluxe), colors, etc:

https://github.com/lsd-rs/lsd

found via: https://github.com/topics/icons

Sequential Commands

aka a list of commands. Separate each command by &&

https://www.gnu.org/software/bash/manual/bash.html#Lists

Current Directory

search terms used: "bash name of current directory"

printf '%s\n' "${PWD##*/}"

via