Cmdline
- Select column using awk and apply base64 for one of them:
cat file | awk -F ':' '{ "echo -n "$3" | base64" | getlline x
print $1, $2, x}'
Exemple:
$ cat a
plop:glou:coin:qweqwe
foo:bar:test:qweqwe
$ cat testfile.txt | awk -F ':' '{ "echo -n "$3" | base64" | getline x
print $1, $2, x}'
plop glou Y29pbg==
foo bar dGVzdA==
- Access environment variable (-v awk_var=env_var)
$ for a in $(seq 1 100)
do
nmap -p 25 --source-port $a www.example.com | grep tcp | awk -v var=$a '{print var ":" $1 ":" $2}'
done
1:25/tcp:open
2:25/tcp:open
3:25/tcp:open
4:25/tcp:open
5:25/tcp:open
6:25/tcp:open
7:25/tcp:filtered
8:25/tcp:open
tmux
copy - paste
- Enter copy mode:
Ctrl + <prefix> + [ - Start selection: Ctrl+SPACE
- Move with keys
Ctrl+wto copy into Tmux buffer- In the same tmux, but could be different windows/pane,
vim /tmp/mycopy, insert mode thenCtrl+<prefix> + ]
Search
- Enter copy mode:
Ctrl + <prefix> + [ - Ctrl+s to type the string to search
- Enter search
- Shift-n for reverse search
- Shift-r for reverse direction
Create new session inside a session
Ctrl + <prefix> :new -s <name>
swap panes
Ctrl + <prefix> }swap-pane with the next oneCtrl + <prefix> {swap-pane with the previous one
move panes
Ctrl + <prefix> :join-pane -s :1bring active pane on window 1 to current window- or
- Identify with
Ctrl+ <prefix> + qthenCtrl + <prefix> :join-pane -s 1bring pange 1 into the current space
zip
- list file in zip:
unzip -l <file.zip>
zip -sf <file.zip>
- extract one file from the zip:
unzip -p <file.zip> path/to/file > file
unzip -j <file.zip> path/to/file -d .
tar.gz
- list file in tar.gz
tar -tvf <file.tar.gz>
- compress with automatical detection of extension
tar -cvaf dir.tzst dir
- decompress with automatical detection of extension
tar -xvaf dir.tzst
zst
zstd -l <file.zst>