LINUX COMMANDS
- 
COPY 
- 
cp index.js node-server/to the directory
- 
cp index.js main.jsto the current directory
 
- 
- 
Restart:  sudo reboot
- 
Update-Upgrade sudo apt-get updatesudo apt-get upgrade
- 
Switch User su - afozbek
- 
User Add useradd afozbek-simple- adduser afozbek
 
- 
List Users nano /etc/passwd
- 
Delete User deluser —remove-home newuser
- 
Add Password to User passwd afozbek-simple
- 
Add SSH KEY sudo nano ~/.ssh/authorized_keys
- 
Change SSH Config sudo nano /etc/ssh/sshd_config
- 
Enable Firewall sudo ufw enable- 
List sudo ufw app list- * Nginx Full: This profile opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic)
- Nginx HTTP: This profile opens only port 80 (normal, unencrypted web traffic)
- Nginx HTTPS: This profile opens only port 443 (TLS/SSL encrypted traffic)
 
 
- 
List 
- 
Look for System is Working Properly
- sudo systemctl status sshd
- sudo systemctl restart ssh
 
- 
Look Memory Usage 
- free -h
- vmstat -s
 
NGINX (LIKE APACHE) - Reverse Proxy
What is a Reverse Proxy Server? | NGINX
- 
Stop sudo systemctl stop nginx
- 
Restart service nginx restart
- 
Start sudo systemctl start nginx-  Default HTML location: /var/www/html
 
-  Default HTML location: 
- 
/etc/nginx: The Nginx configuration directory. All of the Nginx configuration files reside here.
- 
/etc/nginx/nginx.confThe main Nginx configuration file. This can be modified to make changes to the Nginx global configuration.- Access Log: /var/log/nginx/access.log
- Error Log: /var/log/nginx/error.log
 
- Access Log: 
- 
/etc/nginx/sites-available/: The directory where per-site “server blocks” can be stored. Nginx will not use the configuration files found in this directory unless they are linked to the sites-enabled directory (see below).
- 
/etc/nginx/sites-enabled/: The directory where enabled per-site “server blocks” are stored.
- 
/etc/nginx/snippets: This directory contains configuration fragments that can be included elsewhere in the Nginx configuration.
PM2
- pm2 stop app_name_or_id
- pm2 list
- pm2 info app
- To Start All instance on startup pm2 startup ubuntu
Nano
- 
CTRL + 6for Mark Set and mark what you want (the end could do some extra help).
- 
ALT + 6copy selected line
- 
CTRL + Kfor cutting what you want to copy
- 
CTRL + Ufor pasting what you have just cut because you just want to copy.
- 
CTRL + Uat the place you want to paste.
DOCKER
How To Install and Use Docker on Ubuntu 18.04 | DigitalOcean
- Add User to Docker Group sudo usermod -aG docker username
- Check User is in the Docker Group id -nG
- To view system-wide information about Docker, use: docker info
- Find and download(if not exist) an image from Docker Hub: docker run {image}- Ex: docker run hello-world
 
- Ex: 
- Search and list images : docker search {image}- Ex: docker search ubuntu
 
- Ex: 
- Run a Container and switch to the interactive terminal(-it)
- docker run -it ubuntu
 
- Listing containers
- List running containers  docker ps
- List stopped containers docker ps -f “status=exited”
- List all containers docker ps -a
- View latest container docker ps -l
 
- List running containers  
- Start or Stop a container with its containerId
-  docker start {containerId}
- docker stop {containerId}
 
-  
- Remove a container  with its containerId or name
- docker rm {containerId}
- docker rm {name}
 
- Remove an image with its imageId or name
- docker rmi {imageId}
- docker rmi {name}
 
- Start a container with giving a custom name with —name
- docker run --name newName {imageName}
 
- Manage your changes
- Commit: docker commit -m "added Node.js" -a "{userName}" {containerId} "{userName}"/{newImageName}
- Push docker push {userName}/{imageName}
 
- Commit: 
- Listing the Docker images - (You can see your new image there 😁)
- docker images
 
- Login to Docker Hub
- docker login -u {docker-registry-username}
 
 

 
    
Top comments (0)