Last active
August 17, 2020 15:21
-
-
Save Eomm/6d13bf7d73b811f38ba81d3ce5877eb3 to your computer and use it in GitHub Desktop.
Bash snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bash snippet | |
## List service | |
service --status-all | |
ls -F /etc/init.d/ | grep '*$' | |
## File Descriptors | |
### Open socket by node.js | |
lsof -n -i -P | grep node | wc -l | |
### Check how many FD are open at startup | |
strace -ff -s 512 -ttt -T -x -o strace.out node app.js | |
### Check opened port of a process | |
netstat -aop | grep <pid> | |
### ss - socket statistics | |
ss -ltp | |
## File system | |
### Disk usage | |
df -h | |
### Directory's size | |
du -sh /home/smpp3/ | |
### Directory's size details | |
du -shc /home/smpp3/* | |
### Compact and remove | |
tar --remove-files -zcvf log/archive.tar.gz pattern_* | |
### Unzip all gz in directory | |
find . -name "*.gz" | while read filename; do tar -zxvf "$filename" -C ./; done; | |
find . -name "*.gz" | while read filename; do gzip -d "$filename"; done; | |
## Kill | |
### Kill all node.js process | |
for pid in $(ps -ef | grep "node" | awk '{print $2}'); do kill -9 $pid; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stop all container | |
docker stop $(docker ps -a -q) | |
# Stop all container - win | |
docker ps -a -q | ForEach { docker stop $_ } | |
# Run node project in a docker container | |
docker run --rm -it -v "C:\Users\mspigolon\workspace\project:/app/" --net mynet node:12 bash | |
# A net to connect containers | |
docker network create mynet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment