Skip to content

Instantly share code, notes, and snippets.

@yogggoy
Last active February 19, 2021 11:27
Show Gist options
  • Save yogggoy/7bdf36090f26b44c95c6700554d5ca57 to your computer and use it in GitHub Desktop.
Save yogggoy/7bdf36090f26b44c95c6700554d5ca57 to your computer and use it in GitHub Desktop.
linux tips

SSH

close ssh connections on server

hard mode :

pkill -U USER_NAME

soft mode:

who  # found session and pts number
pkill -9 -t pts/NUMBER

long mode:

ps -ef | grep USERNAME | grep ssh
kill -9 PID
ssh config
# proxy
Host node1
        HostName 192.168.1.2

Host other_node2
        ProxyCommand ssh -q node1 /bin/nc.traditional [other_node2 IP] 22
        User none

Host gitlab
        ProxyCommand ssh -q node1 /bin/nc.traditional [other_node2 IP] 22
        User git
        ForwardX11 no
        RequestTTY no

sshfs

sshfs SERVER:path/to/project/. ~/tmp/mount_ssh/


terminal Hotkeys

  • Ctrl+Z suspending process
    • fg NUM return process to display
    • bg NUM continue process in background
    • jobs puts list process
  • Ctrl+R find in terminal history
  • Ctrl+L clear terminal
  • Ctrl+W delete word
  • Ctrl+Shift+3 - commented current input line
  • Ctrl+P Previous command, arrow UP duplicate
  • Ctrl+N Next command, arrow DOWN duplicate
  • Ctrl+J ENTER command duplicate
  • Ctrl+[ ESC command duplicate
  • Ctrl+C Interrupt/Clear/Stop
  • Ctrl-D close session/terminal
  • Ctrl-A HOME command duplicate
  • Ctrl-E END command duplicate
  • Ctrl-x+Ctrl-e edit cmd line in editor and execute

https://ss64.com/bash/syntax-keyboard.html - more hotkey

PS1="\[\e[4m\e[01;42m\]\u@\h\[\e[01;33m\]::\W$\[\e[00m\] "


utils

dmesg -wH infinity output dmesg log

grep --color --exclude={*.o,*.so,grep.sh} -nrC1 "rs_esdvnpn_wf" .

screen /dev/ttyUSB0 115200 minicom alternative

ctrl+a k yes/no - for close serial connection in screen

tmux printf '\033]2;%s\033\\' 'title goes here' set pane name in tmux 2.3
[https://stackoverflow.com/questions/9747952/pane-title-in-tmux]


svn:

  • svn co PATH get home copy from server
  • svn log [--limit 10] [last 10] commits
  • svn log -v changed files
  • svn log --diff changes (svn diff -c 1.6v)
  • svn info info about home copy
  • svn stat vhat is changed
  • svn up [-rXXXX] update svn home copy [to revision number]
  • svn blame

vim:

  • d cut
  • y copy
  • p/P paste
  • u undo
  • ctrl+r redo
  • :e - open file
  • :bn - next file
  • :bp - previous file
  • :Ex - explorer?
  • :sp - split window
  • :vsp - vertical split
  • Ctrl+w, w - next window
  • G - to end of file
  • gg - to first line in file
  • 1G 5G [0-9+]G - go to line number 1, 5, ...

Link tips

installing libftdi on Centos7 it is hard. And you may have problem undefined symbol: libusb_handle_events_timeout_completed

http://blog.hajma.cz/2016/02/solved-gqrx-crash-on-startup.html

http://helpany.ru/otladka-s-pomoschu-ltrace/

use ldd and ltrace

gnome disable workspace switch Ctrl+Alt+[Up/Down] https://unix.stackexchange.com/questions/394143/how-to-disable-gnome-ctrlaltdown-and-ctrlaltup-shortcut

sudo apt-get install dconf-tools
dconf-editor
in dconf-editor go to: /org/gnome/desktop/wm/keybindings/
Find switch-to-workspace-down, put ['disabled'] instead of default
same for ...-up
quit dconf-editor and you are done


fonts

mkdir ~/.fonts
cp *fonts_list* ~/.fonts

other

https://stackoverflow.com/questions/35519538/visual-studio-code-tab-key-does-not-insert-a-tab

Ctrl + M - Tab Moves Focus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment