Skip to content

Instantly share code, notes, and snippets.

@xkef xkef/shell.txt
Last active May 16, 2019

What would you like to do?
zsh vim ...
## 16/05/19
❯ lsof -i -n -P | grep node 0.17s [master] ~/code/curl
node 764 xkef 15u IPv4 0x2069afb6333f5135 0t0 TCP (LISTEN)
node 764 xkef 19u IPv4 0x2069afb6333f47b5 0t0 TCP (LISTEN)
❯ mtr
sudo !! - re-run previous command with 'sudo' prepended
ctrl-k, ctrl-u, ctrl-w, ctrl-y - cutting and pasting text in the command line
practical kill/yank example
use 'less +F' to view logfiles, instead of 'tail' (ctrl-c, shift-f, q to quit)
ctrl-x-e - continue editing your current shell line in a text editor (uses $EDITOR)
alt-. - paste previous command's argument (useful for running multiple commands on the same resource)
reset - resets/unborks your terminal
❯ pstree
❯ du -sh ../curl 0.10s [master] ~/code/curl
88M ../curl
❯ nmap -n -PN -sT -sU -p- localhost
❯ netstat -tupln
### lsof
Which files are open?
❯ lsof
Which processes have this file open?
❯ lsof /var/log/nginx-error.log
Which files does process X have open?
❯ lsof -p 1
❯ lsof -p `pgrep ABC`
Where is the binary for this process?
❯ lsof -p ABC | grep bin
Which shared libraries is this program using? (manually upgrading software, i.e. openssl)
❯ lsof -p PID | grep .so
Where is this thing logging to?
❯ lsof -p ABC | grep log
Which processes still have this old library open?
❯ lsof grep
Which files does user XYZ have open?
❯ lsof -u XYZ
❯ lsof -u XYZ -i # network only
Which process is listening on Port X (or using Protocol Y)?
❯ lsof -i :80
❯ lsof -i tcp
## 13/05/19
- iftop, arpspoof, ip, dig, nmap, wireshark, jq, curl,
## shortcuts
$ name session
s list sessions --> cool
w list windows --> cool
. move window
, rename pane
## do
+ clean up dotfiles - remove uneeded stuff (.vim and .zsh)
+ update dotfiles repo
+ command-t: usage?
+ check .zsh/functions
+ check .vimrc
+ sk - fuzzy finder in rust
+ ag - The Silver Searcher. Like ack, but faster.
+ nvim 0.3.5: language server for: js, rust
+ pgcli
+ tmux ctrl-space-?
+ netcat, nmon, glances
## log
- git stash save, git pull origin/HEAD, removed brew ruby, compiled nvim 0.3.5, gem install nvim and commant-t works :)
- update tmux to 2.9, needed to fix tmux.conf and .zsh tmux calls
- enabled syntax hl in .zshrc
- no bg colors for tmux / zsh: # command tmux set -a window-style "bg=#$CC"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.