Command line tools
Jul 2, 2021
sed
vim
productivity
Purpose
The purpose of this document is to flex my command-line and vim muscles.
Remove first n characters from a file
:%s/^………//g or :%s/^.\{,n\}//g
Remove last n characters from a file
:%s/……$//g or :%s/.\{,n\}$//g
Find the number of occurrences of a specific search
grep “dimsum” /var/logs/syslog | awk ‘{ print $11}’ | sort -n | uniq -c | sort -nr | head
24 f43962d85f
23 8c13c10f48
22 892b7b0a4a
22 1f4214be46
20 7shdf8sjfk
Screen
- view: screen -ls
- attach: screen -x …
- new: screen
- see all: ctrl a + "
- new tab: ctrl a + c
- name tab: ctrl a + shift a