|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# AUTHOR : Arnob kumar saha |
| 4 | +# Date created : 11-06-2022 |
| 5 | +# Lase modified : 11-06-2022 |
| 6 | + |
| 7 | +# DESCRIPTION : This holds some shortcuts and tricks for terminal usage. |
| 8 | +# USAGE : ./tricks.sh |
| 9 | + |
| 10 | + |
| 11 | +cd - # cd to the prevoius directory |
| 12 | +ctrl + L # clear the terminal, scrolling the mouse to above is possible though |
| 13 | + |
| 14 | +pushd <dir> # cd to <dir> & pushes <dir> on a stack, to later cd into that using popd |
| 15 | +popd # cd to the stack's top directory & pod that from stack |
| 16 | + |
| 17 | +ctrl + z # suppose you are editing on vim & u for some reason want to go back to your current terminal |
| 18 | +# without saving ow quitting the editing file |
| 19 | +fg # (foreground) to again get back to editing |
| 20 | + |
| 21 | +sudo !! # exexute the last command with sudo previledges |
| 22 | +ctrl + r # search some previous running command from terminal history |
| 23 | + |
| 24 | +HISTTIMEFORMAT="%Y-%m-%d %T " # now `hostory` command will also show you the data-time of the command execution |
| 25 | +!<ID from `history` command> # to execute a particular command from history |
| 26 | + |
| 27 | +cmatrix # cool hacker-like background ! |
| 28 | +ctrl + shift + plusSign # to increase terminal font size |
| 29 | +ctrl + minusSign # to decrease |
| 30 | + |
| 31 | +ctrl + a # move cursor on the beginning of the current line |
| 32 | +ctrl + e # move cursor on the end of the current line |
| 33 | +ctrl + w # delete the last word |
| 34 | +ctrl + u # delete the whole line |
| 35 | + |
| 36 | +tail -f <file> # to watch last few lines of a continously-changing file |
| 37 | +truncate -s 0 <file> # make this file size 0 (Delete everything from this file) |
| 38 | +mount | column -t # 'column' command shows the output in column to look it better |
| 39 | + |
| 40 | + |
| 41 | + |
0 commit comments