Creating tar file and naming by current date

Like this: name=$(date ‘+%Y-%m-%d’) tar -zcvf “$name.tar.gz” code or even in one line: tar -zcvf “$(date ‘+%Y-%m-%d’).tar.gz” code Drop -z flag if you want .tar instead of .tar.gz. Use %y instead of %Y if you want just 2 digits of a year (17 instead of 2017). $() is used for command substitution.

How do you run a script on login in *nix?

From wikipedia Bash When Bash starts, it executes the commands in a variety of different scripts. When Bash is invoked as an interactive login shell, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads … Read more

How can I format the output of a bash command in neat columns

column(1) is your friend. $ column -t <<< ‘”option-y” yank-pop > “option-z” execute-last-named-cmd > “option-|” vi-goto-column > “option-~” _bash_complete-word > “option-control-?” backward-kill-word > “control-_” undo > “control-?” backward-delete-char > ‘ “option-y” yank-pop “option-z” execute-last-named-cmd “option-|” vi-goto-column “option-~” _bash_complete-word “option-control-?” backward-kill-word “control-_” undo “control-?” backward-delete-char