To get list of params of each command, using this pattern: <command> --help
To get the version of command/package, using this pattern: <command> --version
To run command as superuser, put sudo
at the begining of line
clear
- Print system info:
uname
- Print all system info:
uname -a
- list items in current folder:
ls
- list all items (including hidden items):
ls -a
- go down to subfolder in current folder:
cd <foldername or path>
- go up to parent of current folder:
cd ..
mkdir <folder name>
rm -Rf <folder name>
touch <file>
ex: touch hello.js
rm <file name>
top
to exit top
press Ctrl + C
apt-get install <list of package names separated by whitespace>
or
sudo apt-get install <list of package names separated by whitespace>
apt-get remove <list of package names separated by whitespace>
or
sudo apt-get remove <list of package names separated by whitespace>
netstat -tulpn | grep LISTEN
OR
sudo lsof -i -P -n | grep LISTEN
reboot
shutdown -p
- Open file:
nano <filename>
- Save changes:
Ctrl + S
- Exit nano:
Ctrl + X
- Open file:
vi <filename>
- Using arrow keys to move cursor
- Turn on edit mode: press
i
- Exit edit mode: press Ecs
- Save changes and exit vim: type
:wq
and press Enter - Exit and discard changes: type
:q!
and press Enter
- Print running containers:
docker ps
- Print all containers:
docker ps -a
docker images
OR
docker images --all
docker build <docker file or path to docker file>
docker rmi <images>
OR
docker rmi -f <images>
docker create <image name>
docker rm <containers>
OR
docker rm -f <containers>
docker cp <container>:<path to file/folder> <destination in localsystem>
docker start <container ids or names>
docker stop <container ids or names>
docker exec <container> <command>
docker top <container>
`docker logs <container>`
`docker system prune --all`
docker-compose allow us to define and run multi-container with docker.
We can define containers in one file named docker-compose.yml
.
When we run command docker-compose up
, docker will automatically pull all images, create containers, and run it.
To stop all defined containers, just run docker-compose down
.
Note that docker-compose
only runs on a file same name as docker-compose
.
Using param --global
to run node command on global/root node
Print node version, run node --version
Print npm version, run npm --version
Print nvm version, run nvm --version
`npm install`
`npm install <package names>`
To save packages need for development, using --save-dev
`npm uninstall <package names>`
npm ls
copy
ctrl + shift + C
paste
ctrl + shift + V
switch between workspaces
ctrl + alt + arrow(up, down, left, right)
move selected Window to other workspaces
ctrl + shift + alt + arrow(up, down, left, right)
format code
shift + alt + F
save current file
ctrl + S
move lines/carrets
select lines and press: `alt + arrow(up, down, left, right)
copy lines
select lines and press: `ctrl + shift + arrow(up, down, left, right)
quick select a word
ctrl + shift + arrow(left, right)
insert another cursor
shift + alt + arrow(up, down)
edit multiple words
select to-be-edited word and press: ctrl + D
#INSTALL DOCKER & COMPOSE ON UBUNTU
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable edge test"
sudo apt-get update
apt-cache policy docker-ce
sudo apt-get install -y docker-ce
docker status:
sudo systemctl status docker
grant permission:
sudo usermod -aG docker $(whoami)
###subsequent starting group of services, use EITHER one of these:
docker-compose up
hit Ctrl+C to stop
docker-compose up --detach
docker-compose stop
docker-compose start
docker-compose stop