bash

use parameter of previous command (ref 1)

mkdir test
cd $_
or
mkdir test
cd !$

find examples

find . -type f -iname "*regex*" -exec rm -f {} \;

when was user created (ref_2)

  • if user has never logged in after account creation ls -l /home/<user>/.bash_logout

run bg job and log out

after 'ctrl-z'

disown -h %1
bg 1
logout
where 1 is the job number

; Command 1 ; Command 2 Run command 1 first and then command 2 && Command 1 && Command 2 Run command 2 only if command 1 ends sucessfully || Command 1 || Command 2 Run command 2 only if command 1 fails

sneaky workarounds

  • disable logoug timeout (stackexchange)
    if [ ! -z "$TMOUT" ]; then
      env -i bash --init-file ~/.bash_profile
    fi

ref