Tag Archives: shell
Shell: repeat a task multiple time
All shells (bash/zsh): watch -n 3 «curl —location —request GET ‘http://…'» will run curl every 3 seconds until you break it. zsh specific: repeat 5 { curl —location —request GET ‘http://…’ } will repeat it 5 times without any delay
Interesting alternative to grpc_cli
https://github.com/ktr0731/evans It has REPL mode and CLI mode for e2e tests I think, it could be a good alternative to grpc_cli.
Pipeline view in shell
tail -f /var/log/nginx/access.log | pv —line-mode —rate > /dev/null https://serverfault.com/questions/473905/is-there-a-unix-linux-command-to-count-lines-per-second-from-stdin
grep, zgrep, less and zless regexp examples
Grep all files with mask: grep «regex to find» /var/log/lb-*.net/nginx/error.log Grep all zipped files with mask: zgrep «regex to find» /var/remote-log/nodejs-1*.net/node/error.log.* Less all files with mask: less /var/log/lb-*.net/nginx/error.log Grep all zipped files with mask: zless /var/remote-log/nodejs-1*.net/node/error.log.* Tail all files with mask: tail -f /var/log/lb-*.net/nginx/error.log
Search for occurencies in directory with grep
grep -rnw ‘/path/to/somewhere/’ -e ‘pattern’ https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux
How to count resource usage in linux
ps -eo pid,ppid,cmd,%mem,%cpu —sort=-%mem | head -n 5 It will output something like this: PID PPID CMD %MEM %CPU 2591 2113 /usr/lib/firefox/firefox 7.3 43.5 2549 2520 /usr/lib/virtualbox/Virtual 3.4 8.2 2288 1 /home/gacanepa/.dropbox-dis 1.4 0.3 1889 1543 c:\TeamViewer\TeamViewer.ex 1.0 0.2 2113 1801 /usr/bin/cinnamon 0.9 3.5
grep по файлам в директории
grep -nr ‘yourString*’ ./your/dir http://stackoverflow.com/questions/4121803/how-can-i-use-grep-to-find-a-word-inside-a-folder
Настройки клавиатуры в iTerm
Чтобы включить нормальные перемещения по словам и тп: Go to iTerm Preferences → Profiles, select your profile, then the Keys tab. Click Load Preset… and choose Natural Text Editing.
Более быстрое обновление пакетов yum
У нас деплой производится rpm-пакетами на CentOS командой sudo yum install [пакет] При этом часто пишется, что нового пакета нет, хотя он точно есть, просто проверка репозитория производится не каждый раз. Чтобы заставить машину сначала проверить репозитории, нужно выполнить следующее: sudo yum clean rpmdb sudo yum install [пакет] http://yum.baseurl.org/wiki/YumCommands или yum makecache sudo yum install …
Git: посмотреть последние merge веток
git log -n50 | grep Merge