~~NOTRANS~~ ====== Linux Terminal / bash ====== ===== Shutdown later (at) ===== https://www.computerhope.com/unix/uat.htm when leaving office with running processes sudo at 20:55 shutdown -h now # press Ctrl + d # relative: sudo at now + 2 hours sudo at now + 30 minutes Lock screen (usually ''Windows key + L'') and leave ===== Bash Console tricks ===== * https://itsfoss.com/linux-command-tricks/ * https://opensource.com/article/18/5/bash-tricks * https://likegeeks.com/linux-command-line-tricks/ * https://linuxconfig.org/bash-command-line-tips-and-tricks ===== Tab key ===== try tab for autocompletion - sometimes even twice ===== to previous directory ===== cd - ===== to home directory ===== cd ~ # or simpler: cd ===== browse/search history ===== * simply use arrow up/down or * ''Ctrl + r'' and continue with search term * ''Ctrl + r'' again for multiple/next match * ''Ctrl + c'' to abort or history |grep term ===== keyboard shortcuts ===== check all with ''bind -p'' * ''Alt + .'' prints last argument from previous command * ''Ctrl + x + *'' expand glob/star * ''Ctrl + arrow'' move by word * ''Alt + f'' move to next word * ''Alt + b'' move to prev word * ''Ctrl + u'' to delete line to begin of line * ''Ctrl + k'' to delete line to end of line * ''Ctrl + l'' clear screen (lower ''L'') ===== aliases and functions ===== https://askubuntu.com/questions/17536/how-do-i-create-a-permanent-bash-alias ===== reuse/insert last item from previous command ===== * write ''!$'' * ''Alt + .'' ===== reuse/insert full last command line, e.g. for sudo ===== sudo !! ===== combine multiple commands ===== * '';'' execute sequentially * ''&&'' execute next on success * ''|''''|'' execute next on fail - until first success following command prints just "hello" false || false || echo hello || echo world ===== display output as table ===== cat /etc/passwd | column -t -s : ===== history handling with multiple terminals ===== * https://askubuntu.com/questions/80371/bash-history-handling-with-multiple-terminals * https://unix.stackexchange.com/questions/1288/preserve-bash-history-in-multiple-terminal-windows * https://www.baeldung.com/linux/preserve-history-multiple-windows ===== nano: delete line(s) ===== https://monovm.com/blog/how-to-delete-line-in-nano-delete-all/ * ''Ctrl + Shift + 6'' starts mark * ''Ctrl + K'' deletes marked region ===== Links ===== * https://hackingcpp.com/dev/command_line_tools.html * https://github.com/rothgar/awesome-tuis * https://github.com/alebcay/awesome-shell * https://github.com/agarrharr/awesome-cli-apps * https://github.com/k4m4/terminals-are-sexy * * https://github.com/busyloop/lolcat * terminal over web * https://github.com/tsl0922/ttyd * improved tree * https://github.com/dduan/tre * sparklines: * https://github.com/sindresorhus/sparkly-cli * generate/analyze/convert colors: * https://github.com/sharkdp/pastel * socket statistics * https://ubuntu.com/blog/ss-another-way-to-get-socket-statistics * ultimate plumber * https://ostechnix.com/ultimate-plumber-writing-linux-pipes-with-instant-live-preview/ * analyzing server performance * https://www.redhat.com/sysadmin/analyzing-linux-server-performance-atop * fzf: cli fuzzy finder * https://github.com/junegunn/fzf * https://pragmaticpineapple.com/four-useful-fzf-tricks-for-your-terminal/ * thefuck - correct previous console command * https://github.com/nvbn/thefuck * leyrer * tmux @ GPN18: https://www.youtube.com/watch?v=JhKXOYepX2E * cli tools @ GPN18: https://www.youtube.com/watch?v=OlQMXu4yCGk * cli tools @ GPN19: https://www.youtube.com/watch?v=8d8-PpcLc24 * allein zu haus: https://www.youtube.com/watch?v=uEEHq6f8RsM * Sven Guckes (RIP) * Grazer Linuxtage (GLT) 2010: https://www.youtube.com/watch?v=lpfurbNXzHM * Grazer Linuxtage (GLT) 2013: https://www.youtube.com/watch?v=pl1yfqy20Gk * vim 2014: https://www.youtube.com/watch?v=-EJQf9-xMFg * figlet, toilet, * kielux 2015: https://www.youtube.com/watch?v=prSBaBj-xEA * Grazer Linuxtage (GLT) 2016: https://www.youtube.com/watch?v=evq2XqSjHDs * FrOSCon Map 2016: https://www.youtube.com/watch?v=EL6ne4oSjjc * LUGA 2917: vim fuer Fortgeschrittene 1: https://www.youtube.com/watch?v=YGVeNNFLIBM * [[https://eli.thegreenplace.net/2013/12/26/adding-bash-completion-for-your-own-tools-an-example-for-pss|Adding bash completion for your own tools]]