Last active
July 29, 2019 01:46
-
-
Save mnikn/a2d5020bd2909ace57c9337076e7a555 to your computer and use it in GitHub Desktop.
[bash] linux bash common commands #linux
This file contains hidden or 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
### 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