Tips and Tricks for interactive use
History expansion: do not repeat yourself
!<command or number>:$: the last argument of that command!commandis the last command starting withcommand(a bit likeCTRL-R)
Readline and editing mode
You can set up vi(m)/emacs keybindings to navigate the command line while editing a command
If that is not enough, you can open an editor to edit the command you are typing (
vifset -o vi,CTRL-X CTRL-Eifset -o emacs)
Multitasking et similia
Working on multiple directories:
cd -to toggle between 2 directoriespushdto switch between more than 2 directories
cd
mkdir 1 2 3 4
cd 1
pushd ../2
pushd ../3
pushd ../4
pushd -0 # rotate
pushd +1 # rotate
pushd # exchange the 2 top dirs (similar use case to cd -)
Using multiple applications at the same time
Suspend a job with
CTRL+ZDo something else
Resume with
fg
If you are curious:
See with
jobsjobspec:%n
Alternative: multiple terminals with ssh connections.
This has the disadvantage of requiring multiple log ins and can be tedious (but it can be streamlined by having ssh keys correctly set up).
Alternative: tmux
tmux stands for Terminal Multiplexer.
Usage:
start with
tmuxdetach with
CTRL+B Dreattach with
tmux aif you like working with different panes:
split with
CTRL+B %orCTRL+B "change pane with
CTRL+B o
if you like working with different windows:
create new window with
CTRL+B cchange to window n. N with
CTRL+B N
help:
CTRL+B ?exit help:
q
Gotchas:
killed when you log off the node (unless lingering is enabled)
When there are multiple login nodes, you might land on a different node where your session(s) are not available