CLI tools

find, search, grep

find

use cases:

more examples

find /path -name *.txt
find /path -type f -name test.txt
find /path -name failed*.* -type f
find /path -type f -not -name "*.html"
find / -name "file.txt" -size +4M
find /dev/ -type b -name "sda*"
find ./*file*

grep

grep [OPTION]... PATTERNS [FILE]...

examples

sed

sed -i 's/SEARCH_REGEX/REPLACEMENT/g' INPUTFILE

Cronjob, tar, autostart, sudo, ln

cronjob

tar

useage: tar [OPTION...] [FILE]...

autostart

sudo

add user to sudo

su -
usermod -aG sudo <username>

no password sudo

CLI Editor

nano

cli parameters/flags

set defaults by editing /etc/nanorc or in ~/.nanorc: (some recommendations)

## Constantly display the cursor position in the status bar or minibar.
set constantshow

## Display line numbers to the left (and any anchors in the margin).
set linenumbers

## Enable mouse support, if available for your system.  When enabled,
## mouse clicks can be used to place the cursor, set the mark (with a
## double click), and execute shortcuts.  The mouse will work in the
## X Window System, and on the console when gpm is running.
set mouse

## Make the Home key smarter: when Home is pressed anywhere but at the
## very beginning of non-whitespace characters on a line, the cursor
## will jump to that beginning (either forwards or backwards).  If the
## cursor is already at that position, it will jump to the true start
## of the line (the left edge).
# set smarthome

## Spread overlong lines over multiple screen lines.
# set softwrap

userful short cuts

shortcuts are displayed on the bottom, maximize to see more

vim

tutorials

vim modes

base commands

movement

text editing

find and replace

searching only

example: /Linux\c + Enter

find and replace

:[range]s/{pattern}/{string}/[flags]

user management

create user

disk/file management

disk

show disk size

show folder size

find biggest folders of current directory

du -hs * | sort -rh | head -5

file movements

rsync

options

local to remote server

rsync [option] [source] user@hostname-or-ip:[destination path]
rsync -avhz /home/source-rsync/ user@your-remote-server.com:/home/dest-rsync/

remote to local server

rsync -avhz user@your-remote-server.com:/home/dest-rsync/ /home/source-rsync/

scp

scp <Optionen> <Quellpfad> <Zielpfad>

example:

scp -r srv01-local_draab:/var/lib/docker/volumes/wireguard_wireguard-config/_data/ /home/danielraab/wireguard/

tmux

tutorial cheatsheet

configs

edit file ~/.tmux.conf as you like

-> gpakosz github

keyboard shortcuts

Ctrl + b ? - show keyboard shortcut overview

pane

windows

modes

CTRL+b then [ Enter copy mode. q Exit copy mode. SPACE Start text selection in copy mode. ENTER Copy the selected text. ESC Clear the selected text and exit the copy mode. CTRL+b then ] Paste the copied text. h Move the cursor left. j Move the cursor down. k Move the cursor up. l Move the cursor right. w Move the cursor one word forward. b Move the cursor one word backward. CTRL+u Scroll up half a page. CTRL+d Scroll down half a page. PgUp Scroll up full page. PgDn Scroll down full page.

configs

adaption for zsh powershell10k

Your tmux has two issues.

It cannot display 256 colors. To fix this, create ~/.tmux.conf with set -g default-terminal screen-256color in it and reboot your machine.

It cannot display non-ascii characters. To fix this, install and enable a UTF-8 locale in your OS and reboot your machine.

You can verify that you've fixed tmux by running the following command:

print -P -- '--> %F{70}\u276E\u276F%f <--'

basic

suspend and continue