
This guide lists all the necessary Linux commands you should know to effectively deploy applications on
1. Connect to the Server via SSH
ssh -i /path/to/your-key.pem ubuntu@your-server-ip2. Switch to Root User (if necessary)
sudo -i3. Update and Upgrade the Server
sudo apt update && sudo apt upgrade -y4. Check System Information
- View disk space:
df -h- View memory usage:
free -h- Check CPU usage:
top1. List Files and Directories
ls -l2. Navigate Between Directories
cd /path/to/directory3. Create a New Directory
mkdir new-directory4. Copy Files
cp source-file destination5. Move or Rename Files
mv old-name new-name6. Delete Files or Directories
- Delete a file:
rm file-name- Delete a directory:
rm -r directory-name1. Edit Files with Nano
nano file-name2. Edit Files with Vim
vim file-name1. Check Network Connectivity
ping google.com2. Check Open Ports
sudo netstat -tuln3. Check Firewall Status
sudo ufw status4. Allow HTTP/HTTPS Traffic Through Firewall
sudo ufw allow 80
sudo ufw allow 4431. Install a Package
sudo apt install package-name2. Remove a Package
sudo apt remove package-name3. Search for a Package
apt search package-name1. List Running Processes
ps aux2. Kill a Process by PID
sudo kill -9 PID3. Restart a Service
sudo systemctl restart service-name4. Check the Status of a Service
sudo systemctl status service-name1. Change Ownership of a File/Directory
sudo chown user:group file-or-directory2. Change Permissions
chmod 755 file-or-directory3. Add a New User
sudo adduser new-user4. Grant a User Sudo Privileges
sudo usermod -aG sudo user-name
1. Clone a Repository
git clone https://github.com/user/repo.git2. Pull the Latest Changes
git pull3. Check Git Status
git status
1. Start/Stop/Restart a Web Server
- For Nginx:
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx- For Apache:
sudo systemctl start apache2
sudo systemctl stop apache2
sudo systemctl restart apache22. Install Node.js and NPM
sudo apt install nodejs npm3. Install Dependencies for a Node.js Project
npm install4. Run a Node.js Application
node app.js
1. Check Docker Installation
docker --version2. Start a Docker Container
docker run -d -p 80:80 container-name3. List Running Containers
docker ps4. Stop a Running Container
docker stop container-id5. Remove a Docker Container
docker rm container-id1. View Logs of a Service
sudo journalctl -u service-name2. View Nginx or Apache Logs
- Nginx:
sudo tail -f /var/log/nginx/access.log
sudo tail -f /var/log/nginx/error.log- Apache:
sudo tail -f /var/log/apache2/access.log
sudo tail -f /var/log/apache2/error.log
These commands cover the essential tasks you will need to perform when deploying applications on AWS