Loading
  Marius Gafton

Backend Developer

Frontend Developer

Java Engineer

Wordpress developer

Website designer

UIX designer

  Marius Gafton

Backend Developer

Frontend Developer

Java Engineer

Wordpress developer

Website designer

UIX designer

Blog Post

My DevOps tooling basics set for Unix(Ubuntu/Debian/Linux)

June 4, 2020 Devops
My DevOps tooling basics set for Unix(Ubuntu/Debian/Linux)

These are my categorized to cover system management, networking, package management, file handling and more for DevOps tooling

First step Install Midnight Commander:

1.sudo apt install mc

2. mc

System & Process Management


1.Show system info

uname -a

2. Show disk usage

df -h

3.Show memory and swap usage

free -h

4.Real-time resource usage

htop

5.Show running processes

ps aux, ps -a (see all PID)

6.Kill a process by PID

kill -9 <PID>

7. Reboot / shutdown system

sudo reboot (user need to be in sudo group)

 

File & Directory Commands


1.List files

ls -lah

2.Change directory

cd /path/to/dir

3.Create directory

mkdir -p /path/to/dir

4.Copy files/directories

cp file1.txt /dest/

cp -r dir1 /dest/

5. Create empty file “0Kb”

cp file1.txt > file1.txt

6. Move/rename

mv file1.txt /dest/

mv file1.txt file2.txt

7. Delete

rm file.txt

rm -rf dir/

8.Search files

find . -name “*.log”

grep “error” logfile.log

9. Create new file

a ) cat > myfile.txt  (after that Type your content, then press Ctrl+D to save and exit.)

b) nano myfile.txt (after that Type your content, then press Ctrl+X to save and exit.)

c) mc (Midnight Commander)
Navigate to the directory where you want to create the file using the arrow keys or Tab to switch panels.
Open the Command Menu:
Press F9 to open the top menu bar.
Select “File” Menu:
Use the left/right arrow keys to highlight File, then press Enter.
Choose “New…”:
Select New (sometimes listed as New File or just New) and press Enter.
Enter the File Name:
You’ll be prompted to type the name of the new file (e.g., newfile.txt). Type it and press Enter.
Edit the File (Optional):
After creating, you can press F4 to open it in the internal editor.

 

User & Permission Management


1. Switch user

su – username

2. Run command as root

sudo (command)

3. Change directory and file permissions

chmod 755 dir

chmod 644 file.txt

4. Change file ownership

chown user:group file.txt

5. Add a user and change password

sudo adduser username

sudo passwd username

6. Add user to group (e.g., docker group)

sudo usermod -aG docker username


Networking

1.Show IP address

ip a

2.Show routing table

ip r

3. Test connectivity

ping google.com

4. DNS lookup

nslookup google.com

5. Show open ports and services

ss -tuln

netstat -tuln   # If installed

6. Test port connection

telnet host port

nc -zv host port


Package Management (APT)

1.Update repo list

sudo apt update

2. Upgrade packages

sudo apt upgrade -y

3. Install a package

sudo apt install nginx

4.Remove a package

sudo apt remove nginx

directory

apt search package-name


Docker Basics


1. Install required dependencies:
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y

2. Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg –dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

3.Add Docker’s repository:
echo \ “deb [arch=$(dpkg –print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] \ https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable” | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

4. Update again and install Docker:
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io -y

5. Check Docker version

docker –version

6. List images

docker images

7.List running containers

docker ps

8. Start/stop containers

docker start <container>

docker stop <container>

9. Run container

docker run -d -p 8080:80 nginx

10. Build image

docker build -t myimage .

11. Remove unused resources

docker system prune


Systemctl / Service Management

1.Start/stop/restart a service

sudo systemctl start nginx

sudo systemctl stop nginx

sudo systemctl restart nginx

2.Enable/disable on boot

sudo systemctl enable nginx

sudo systemctl disable nginx

3.Check service status

sudo systemctl status nginx


Log Management

1. View logs

tail -f /var/log/syslog

tail -f /var/log/nginx/error.log

2. Journalctl (systemd logs)

journalctl -xe

journalctl -u nginx


Others

1.Download files

curl -O http://example.com/file

wget http://example.com/file

2.Archive and compress

tar -czvf archive.tar.gz folder/

tar -xzvf archive.tar.gz

3.Edit text files

nano file.txt

Git Basics


git –version # Check Git version
git config –global user.name “Your Name” # Set user name
git config –global user.email “you@example.com” # Set email
git init # Initialize repo
git clone URL # Clone repo
git status # Show repo status
git add . # Stage all changes
git commit -m “message” # Commit changes
git push origin main # Push to branch
git pull origin main # Pull latest changes
git log # Show commit history

Kubernetes (kubectl)


kubectl version # Check kubectl version
kubectl config view # View config
kubectl get nodes # List cluster nodes
kubectl get pods # List pods
kubectl get svc # List services
kubectl describe pod POD # Detailed pod info
kubectl logs POD # View pod logs
kubectl apply -f file.yaml # Apply config
kubectl delete -f file.yaml # Delete config
kubectl exec -it POD — bash # Exec into pod