Skip to content

Instantly share code, notes, and snippets.

@mnikn
Last active July 29, 2019 01:46
Show Gist options
  • Save mnikn/a2d5020bd2909ace57c9337076e7a555 to your computer and use it in GitHub Desktop.
Save mnikn/a2d5020bd2909ace57c9337076e7a555 to your computer and use it in GitHub Desktop.
[bash] linux bash common commands #linux
### linux
# find biggest top 10 files or folders in current dir
du -a -h | sort -n -r | head -n 10
# find runing process
# example args:
# process_name: nginx
ps -ax | grep {{process_name}}
### docker
# run bash in container
# example args:
# container_id: 2fb655efb0d5
docker exec -it {{container_id}} /bin/bash
# run docker container, "-v" means link the local files to container files
# example args:
# container_name: nginx-test
# port: 9901:80(first is local port, second is container port)
# link_path: ~/.nginx/conf/nginx.conf:/etc/nginx/nginx.conf (":" means container path, remember no space)
# image: nginx
docker run --name {{container_name}} -p {{port}} -v {{link_path}} -d {{image}}
# delete container
# example args:
# container_id: 2fb655efb0d5
docker rm {{container_id}}
# stop container
# example args:
# container_id: 2fb655efb0d5
docker kill {{container_id}}
# copy files to container
# example args:
# local_file_path: ~/.nginx
# container_id: a97ca3df5caa60f87
# container_file_path: :/etc/nginx
docker cp {{local_file_path}} {{container_id}}{{container_file_path}}
### network
# get outside ip
curl ipinfo.io
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment