Search Commands

Try searching for: "list", "docker run", "git branch", "remove directory"
Search Results

Python Commands

Environment

python3 -m venv venv

Create a new virtual environment.

Example: python3 -m venv myproject_env
environment virtual setup
source venv/bin/activate

Activate virtual environment (Linux/Mac).

Example: source venv/bin/activate
activate environment
pip install -r requirements.txt

Install dependencies from requirements file.

Example: pip install -r requirements.txt
install dependencies
pip freeze > requirements.txt

Export current dependencies to requirements file.

Example: pip freeze > requirements.txt
export dependencies
python -m http.server 8000

Start simple HTTP server on port 8000.

Example: python -m http.server 8080
server development

Django

django-admin startproject myproject

Create a new Django project.

Example: django-admin startproject webapp
django project create
python manage.py runserver

Start Django development server.

Example: python manage.py runserver 0.0.0.0:8000
django server development
python manage.py makemigrations

Create database migrations.

Example: python manage.py makemigrations
django database migrations
python manage.py migrate

Apply database migrations.

Example: python manage.py migrate
django database migrate
python manage.py createsuperuser

Create Django admin superuser.

Example: python manage.py createsuperuser
django admin user

Flask

flask run

Start Flask development server.

Example: flask run --host=0.0.0.0 --port=5000
flask server development
flask db init

Initialize Flask-Migrate database.

Example: flask db init
flask database init
flask db migrate -m "message"

Create new database migration.

Example: flask db migrate -m "Add user table"
flask database migration
flask db upgrade

Apply database migrations.

Example: flask db upgrade
flask database upgrade

NGINX Commands

Configuration

nginx -t

Test NGINX configuration for syntax errors.

Example: nginx -t
test configuration syntax
nginx -s reload

Reload NGINX configuration without stopping.

Example: nginx -s reload
reload configuration
nginx -s stop

Stop NGINX server.

Example: nginx -s stop
stop server
nginx -s quit

Gracefully shutdown NGINX.

Example: nginx -s quit
shutdown graceful

Logs

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

Follow NGINX access log in real-time.

Example: tail -f /var/log/nginx/access.log
logs access monitor
tail -f /var/log/nginx/error.log

Follow NGINX error log in real-time.

Example: tail -f /var/log/nginx/error.log
logs error debug
nginx -V

Show NGINX version and compile-time options.

Example: nginx -V
version info

Portainer Commands

Installation

docker volume create portainer_data

Create volume for Portainer data persistence.

Example: docker volume create portainer_data
volume data persistence
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

Run Portainer CE with SSL on port 9443.

Example: docker run -d -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
run ssl management

Management

docker logs portainer

View Portainer container logs.

Example: docker logs -f portainer
logs debug
docker restart portainer

Restart Portainer container.

Example: docker restart portainer
restart container
docker stop portainer && docker rm portainer

Stop and remove Portainer container.

Example: docker stop portainer && docker rm portainer
stop remove

Linux Server Commands

System Info

htop

Interactive process and system monitor.

Example: htop
monitor processes system
df -h

Show disk space usage in human-readable format.

Example: df -h
disk space usage
free -h

Display memory usage in human-readable format.

Example: free -h
memory ram usage
uptime

Show system uptime and load average.

Example: uptime
uptime load system
lscpu

Display CPU architecture information.

Example: lscpu
cpu architecture info

Services

systemctl status <service>

Check status of a systemd service.

Example: systemctl status nginx
status service systemd
systemctl start <service>

Start a systemd service.

Example: systemctl start nginx
start service
systemctl stop <service>

Stop a systemd service.

Example: systemctl stop nginx
stop service
systemctl restart <service>

Restart a systemd service.

Example: systemctl restart nginx
restart service
systemctl enable <service>

Enable service to start at boot.

Example: systemctl enable nginx
enable boot service

Network

netstat -tulpn

Show listening ports and associated processes.

Example: netstat -tulpn | grep :80
network ports listening
ss -tulpn

Modern replacement for netstat to show sockets.

Example: ss -tulpn | grep :443
network sockets ports
iptables -L

List all iptables firewall rules.

Example: iptables -L -n
firewall iptables rules
ufw status

Show UFW firewall status and rules.

Example: ufw status verbose
firewall ufw status
ping -c 4 <host>

Test network connectivity to a host.

Example: ping -c 4 google.com
network connectivity ping
curl -I <url>

Check HTTP headers and response status.

Example: curl -I https://example.com
http test headers

Security & Users

sudo -i

Switch to root user with environment.

Example: sudo -i
sudo root privilege
sudo su - <username>

Switch to another user account.

Example: sudo su - www-data
sudo user switch
passwd <username>

Change password for a user.

Example: passwd john
password user security
useradd -m -s /bin/bash <username>

Create new user with home directory.

Example: useradd -m -s /bin/bash developer
user create account
usermod -aG sudo <username>

Add user to sudo group.

Example: usermod -aG sudo developer
user sudo permissions
chmod 755 <file/directory>

Set file/directory permissions.

Example: chmod 755 /var/www/html
permissions chmod security
chown -R <user>:<group> <directory>

Change ownership of files/directories.

Example: chown -R www-data:www-data /var/www
ownership chown permissions

Process Management

ps aux

List all running processes.

Example: ps aux | grep nginx
processes monitoring system
kill -9 <pid>

Force kill a process by PID.

Example: kill -9 1234
kill process force
killall <process_name>

Kill all processes by name.

Example: killall nginx
kill process name
nohup <command> &

Run command in background, immune to hangups.

Example: nohup python3 app.py &
background nohup process
screen -S <session_name>

Create a new screen session.

Example: screen -S myapp
screen session terminal
tmux new-session -s <session_name>

Create a new tmux session.

Example: tmux new-session -s development
tmux session terminal

Logs & Monitoring

journalctl -u <service> -f

Follow systemd service logs in real-time.

Example: journalctl -u nginx -f
logs systemd monitoring
tail -f /var/log/syslog

Follow system log in real-time.

Example: tail -f /var/log/syslog
logs syslog monitoring
dmesg | tail

Show recent kernel messages.

Example: dmesg | tail -20
kernel messages hardware
who

Show who is currently logged in.

Example: who
users logged security
last

Show last logged in users.

Example: last -10
users history security

SSH & Remote Commands

SSH Basics

ssh user@hostname

Connect to remote server via SSH.

Example: ssh root@192.168.1.100
ssh remote connection
ssh -p <port> user@hostname

Connect to SSH on custom port.

Example: ssh -p 2222 user@server.com
ssh port custom
ssh-keygen -t rsa -b 4096

Generate SSH key pair for authentication.

Example: ssh-keygen -t rsa -b 4096 -C 'user@email.com'
ssh keys security
ssh-copy-id user@hostname

Copy SSH public key to remote server.

Example: ssh-copy-id admin@server.com
ssh keys copy
scp <file> user@hostname:<path>

Secure copy files to remote server.

Example: scp app.zip user@server:/home/user/
scp copy transfer
rsync -avz <source> user@hostname:<dest>

Synchronize files/directories to remote server.

Example: rsync -avz ./website/ user@server:/var/www/
rsync sync backup

SSH Key Management

ssh-add ~/.ssh/keyname

Add SSH private key to authentication agent.

Example: ssh-add ~/.ssh/id_rsa
ssh agent keys
ssh-agent bash

Start SSH agent for managing private keys.

Example: eval $(ssh-agent -s)
ssh agent security
chmod 600 ~/.ssh/id_rsa

Set correct permissions for SSH private key.

Example: chmod 600 ~/.ssh/id_rsa
ssh permissions security
ssh-add -l

List SSH keys currently loaded in agent.

Example: ssh-add -l
ssh agent list

SSH Security

sudo nano /etc/ssh/sshd_config

Edit SSH server configuration.

Example: sudo nano /etc/ssh/sshd_config
ssh config security
sudo systemctl restart sshd

Restart SSH service after config changes.

Example: sudo systemctl restart sshd
ssh restart service
ssh -i <keyfile> user@hostname

Connect using specific private key file.

Example: ssh -i ~/.ssh/server_key user@server.com
ssh key authentication
ssh -L <local_port>:localhost:<remote_port> user@hostname

Create SSH tunnel for port forwarding.

Example: ssh -L 8080:localhost:80 user@server.com
ssh tunnel forwarding
ssh -v user@hostname

Connect with verbose output for debugging SSH issues.

Example: ssh -v user@server.com
ssh debug verbose
sudo ufw allow OpenSSH

Allow SSH through UFW firewall.

Example: sudo ufw allow OpenSSH
ssh firewall security
sudo fail2ban-client status sshd

Check fail2ban SSH protection status.

Example: sudo fail2ban-client status sshd
ssh fail2ban security
sshd -T

Display active SSH server configuration.

Example: sudo sshd -T | grep Port
ssh config test

Remote Sessions

tmux new -s session_name

Create new tmux session for persistent remote work.

Example: tmux new -s development
tmux session persistent
screen -S session_name

Start screen session for detached remote work.

Example: screen -S server_maintenance
screen session detached
sftp user@hostname

Connect to remote server using SFTP for file transfer.

Example: sftp admin@server.com
sftp transfer secure
ssh user@host 'bash -s' < local_script.sh

Execute local script on remote server via SSH.

Example: ssh user@server 'bash -s' < deploy.sh
ssh script remote

Advanced Tunneling

ssh -R <remote_port>:localhost:<local_port> user@hostname

Create reverse SSH tunnel from remote to local.

Example: ssh -R 8080:localhost:3000 user@server.com
ssh reverse tunnel
ssh -D <local_port> user@hostname

Create SOCKS proxy tunnel through SSH.

Example: ssh -D 1080 user@server.com
ssh socks proxy
ssh -N -f -L <local_port>:localhost:<remote_port> user@hostname

Create background SSH tunnel without shell.

Example: ssh -N -f -L 5432:localhost:5432 user@db-server.com
ssh tunnel background

Package Management Commands

APT (Ubuntu/Debian)

sudo apt update

Update package repository information.

Example: sudo apt update
apt update packages
sudo apt upgrade

Upgrade all installed packages.

Example: sudo apt upgrade -y
apt upgrade system
sudo apt install <package>

Install a package.

Example: sudo apt install nginx
apt install package
sudo apt remove <package>

Remove a package.

Example: sudo apt remove apache2
apt remove package
apt search <keyword>

Search for packages by keyword.

Example: apt search python3
apt search packages
sudo apt autoremove

Remove unused packages and dependencies.

Example: sudo apt autoremove
apt cleanup dependencies
sudo apt list --upgradable

Show available package updates.

Example: sudo apt list --upgradable
apt list upgradable
sudo apt purge <package>

Remove package and its configuration files.

Example: sudo apt purge apache2
apt purge config
sudo apt show <package>

Display detailed package information.

Example: sudo apt show nginx
apt show info
sudo apt-cache policy <package>

Show package version and repository source.

Example: sudo apt-cache policy docker.io
apt policy version
sudo dpkg -i <file>.deb

Install .deb package file directly.

Example: sudo dpkg -i package.deb
dpkg install deb
sudo dpkg -r <package>

Remove package using dpkg.

Example: sudo dpkg -r old-package
dpkg remove package

YUM/DNF (RedHat/CentOS)

sudo yum update

Update all packages (CentOS 7 and older).

Example: sudo yum update -y
yum update centos
sudo dnf update

Update all packages (CentOS 8+/Fedora).

Example: sudo dnf update -y
dnf update fedora
sudo yum install <package>

Install package with YUM.

Example: sudo yum install nginx
yum install package
sudo dnf install <package>

Install package with DNF.

Example: sudo dnf install nginx
dnf install package
sudo yum remove <package>

Remove package with YUM.

Example: sudo yum remove httpd
yum remove package
sudo dnf remove <package>

Remove package with DNF.

Example: sudo dnf remove httpd
dnf remove package
sudo dnf list installed

List all installed packages.

Example: sudo dnf list installed | grep nginx
dnf list installed
sudo dnf info <package>

Display detailed package information.

Example: sudo dnf info nginx
dnf info package

Snap/Flatpak

sudo snap install <package>

Install application using Snap.

Example: sudo snap install code --classic
snap install package
sudo snap remove <package>

Remove Snap application.

Example: sudo snap remove code
snap remove package
snap list

List installed Snap applications.

Example: snap list
snap list installed
flatpak install <package>

Install application using Flatpak.

Example: flatpak install flathub org.gimp.GIMP
flatpak install package
flatpak remove <package>

Remove Flatpak application.

Example: flatpak remove org.gimp.GIMP
flatpak remove package
flatpak list

List installed Flatpak applications.

Example: flatpak list
flatpak list installed

Shell Commands

Navigation

pwd

Print the current working directory.

Example: pwd
print working-directory
ls

List files and directories in the current directory.

Example: ls -lah
list files directories
cd <directory>

Change to the specified directory.

Example: cd /usr/local/bin
change directory
cd ..

Move up one directory level.

Example: cd ..
up directory
cd -

Switch to the previous directory.

Example: cd -
switch previous directory

Directories

mkdir <directory>

Create a new directory.

Example: mkdir project
make directory
rmdir <directory>

Remove an empty directory.

Example: rmdir old_folder
remove directory
rm -r <directory>

Remove a directory and its contents recursively.

Example: rm -r build
remove directory recursive
mv <source> <destination>

Move or rename files/directories.

Example: mv old_folder new_folder
move rename
du -sh <directory>

Show disk usage of a directory in human-readable format.

Example: du -sh logs/
disk usage directory

Files

touch <file>

Create an empty file or update its timestamp.

Example: touch README.md
create file timestamp
rm <file>

Remove a file.

Example: rm temp.txt
remove file
cp <source> <destination>

Copy files or directories.

Example: cp -r src/ backup/src/
copy file directory
cat <file>

Display the contents of a file.

Example: cat notes.txt
view file contents
head <file>

Show the first lines of a file.

Example: head -n 10 logfile.log
file head preview
tail <file>

Show the last lines of a file.

Example: tail -f logfile.log
file tail log

Search & Display

find <path> -name "<pattern>"

Search directories for files matching a pattern.

Example: find . -name "*.log"
search find
grep -R "<text>" <directory>

Recursively search files for a text pattern.

Example: grep -R "TODO" src/
search grep
tree

Display directory structure as a tree.

Example: tree -L 2
tree structure
locate <filename>

Quickly find file paths by name (requires updated database).

Example: locate config.yaml
search locate
which <command>

Show the full path of a command binary.

Example: which python3
command path

File Operations

nano <file>

Edit file in terminal text editor.

Example: nano config.txt
edit file nano
chmod <mode> <file>

Change file permissions.

Example: chmod 755 script.sh
permissions chmod file
chown <user>:<group> <file>

Change file ownership.

Example: chown user:group file.txt
ownership chown file

Archives

tar -czvf <archive.tar.gz> <folder>

Create compressed tar archive.

Example: tar -czvf backup.tar.gz documents/
compress archive tar
tar -xzvf <archive.tar.gz>

Extract compressed tar archive.

Example: tar -xzvf backup.tar.gz
extract archive tar
zip -r <archive.zip> <folder>

Create ZIP archive.

Example: zip -r project.zip project/
compress zip archive
unzip <archive.zip>

Extract ZIP archive.

Example: unzip project.zip
extract zip archive

Terminal Helpers

clear

Clear terminal screen.

Example: clear
clear terminal
history

Show command history.

Example: history | tail -10
history commands

Text Processing

grep "<text>" <file>

Search for text pattern in file.

Example: grep "error" logfile.txt
search grep text
wc -l <file>

Count lines in file.

Example: wc -l data.txt
count lines wc
sort <file> | uniq

Sort file and remove duplicate lines.

Example: sort names.txt | uniq
sort unique filter

Processes

ps aux | grep <process>

Find running processes by name.

Example: ps aux | grep nginx
process search ps
top

Display running processes and system resources.

Example: top
process monitor top
htop

Interactive process viewer (if installed).

Example: htop
process monitor htop

Docker Commands

Container

docker ps

List running containers.

Example: docker ps -a
list containers
docker stop <container_id>

Stop a running container.

Example: docker stop my_container
stop container
docker run -d --name <name> <image>

Run a new container in detached mode.

Example: docker run -d --name webserver nginx
run start container
docker exec -it <container_id> /bin/bash

Open an interactive shell inside a running container.

Example: docker exec -it my_container /bin/bash
exec shell container
docker logs <container_id>

View logs of a container.

Example: docker logs my_container
logs container
docker restart <container_id>

Restart a running container.

Example: docker restart my_container
restart container
docker rm <container_id>

Remove a stopped container.

Example: docker rm my_container
remove container
docker stop $(docker ps -q)

Stop all running containers.

Example: docker stop $(docker ps -q)
stop all container

Images

docker images

List available Docker images.

Example: docker images --all
list images
docker rmi <image_id>

Remove a Docker image.

Example: docker rmi ubuntu:latest
remove image
docker pull <image>

Download an image from a registry.

Example: docker pull node:14
pull download image
docker tag <source_image> <target_image>

Tag an image with a new name.

Example: docker tag ubuntu:latest myrepo/ubuntu:v1
tag image
docker build -t <name> .

Build a Docker image from Dockerfile in current directory.

Example: docker build -t myapp:latest .
build image

Networks

docker network ls

List Docker networks.

Example: docker network ls
list networks
docker network create <network_name>

Create a new Docker network.

Example: docker network create frontend_net
create network
docker network inspect <network>

Show detailed information about a network.

Example: docker network inspect bridge
inspect network
docker network connect <network> <container>

Connect a container to a network.

Example: docker network connect frontend_net webapp
connect network
docker network disconnect <network> <container>

Disconnect a container from a network.

Example: docker network disconnect frontend_net webapp
disconnect network

Volumes

docker volume ls

List Docker volumes.

Example: docker volume ls
list volumes
docker volume create <volume_name>

Create a new Docker volume.

Example: docker volume create data_volume
create volume

Debug

docker inspect <resource>

Show detailed information about containers, images, volumes or networks.

Example: docker inspect my_container
debug inspect details
docker stats

Display live resource usage statistics of running containers.

Example: docker stats --no-stream
debug stats monitoring
docker top <container_id>

Display running processes inside a container.

Example: docker top my_container
debug processes container

Cleanup

docker system prune -a

Remove all unused containers, networks, images and build cache.

Example: docker system prune -a --force
cleanup prune system
docker image prune

Remove dangling and unused images.

Example: docker image prune -a
cleanup prune images
docker volume prune

Remove unused volumes.

Example: docker volume prune --force
cleanup prune volumes

Registry

docker login

Log in to a Docker registry.

Example: docker login docker.io
login registry auth
docker logout

Log out from a Docker registry.

Example: docker logout docker.io
logout registry auth

Context

docker context ls

List available Docker contexts.

Example: docker context ls
context list
docker context use <context>

Switch to a different Docker context.

Example: docker context use remote-docker
context switch

Compose

docker-compose build

Build or rebuild services defined in docker-compose.yml

Example: docker-compose build --no-cache
build compose services
docker-compose up

Create and start containers in detached mode

Example: docker-compose up -d
start compose detached
docker-compose down

Stop and remove containers, networks, volumes

Example: docker-compose down -v
stop cleanup compose
docker-compose logs

View output from containers

Example: docker-compose logs -f web
logs debug compose
docker-compose ps

List running compose services

Example: docker-compose ps
list status compose
docker-compose exec

Execute a command in a running container

Example: docker-compose exec web bash
execute interactive compose
docker-compose restart

Restart services

Example: docker-compose restart nginx
restart compose
docker-compose config

Validate and view the compose file

Example: docker-compose config
validate config compose
docker-compose pull

Pull service images

Example: docker-compose pull
pull images compose
docker-compose pause/unpause

Pause or unpause services

Example: docker-compose pause redis
pause compose
docker-compose stop

Stop running services without removing containers

Example: docker-compose stop web
stop compose
docker-compose rm

Remove stopped service containers

Example: docker-compose rm -f
remove cleanup compose
docker-compose up -d --build

Build images and start services in detached mode

Example: docker-compose up -d --build --force-recreate
build start detached compose

Git Commands

Basics

git init

Initialize a new Git repository.

Example: git init my_project
init repository
git clone <repo_url>

Clone a remote repository.

Example: git clone https://github.com/user/repo.git
clone repository
git status

Show the current status of the working directory.

Example: git status
status workspace
git add <file>

Add changes to the staging area.

Example: git add README.md
add stage
git commit -m "message"

Commit staged changes with a message.

Example: git commit -m "Initial commit"
commit save

Staging

git restore --staged <file>

Remove file from staging area.

Example: git restore --staged README.md
restore unstage staging
git restore <file>

Discard changes in working directory.

Example: git restore config.js
restore discard changes
git reset <file>

Remove file from staging area (legacy).

Example: git reset HEAD file.txt
reset unstage staging

Branching

git branch

List all branches.

Example: git branch --all
list branches
git checkout <branch_name>

Switch to a different branch.

Example: git checkout develop
switch branch
git checkout -b <branch_name>

Create and switch to a new branch.

Example: git checkout -b feature/new-feature
create switch branch
git merge <branch_name>

Merge a branch into the current branch.

Example: git merge feature/new-feature
merge branch
git branch -d <branch_name>

Delete a branch.

Example: git branch -d feature/old-feature
delete branch
git switch <branch>

Switch to a different branch (modern alternative to checkout).

Example: git switch develop
switch branch modern
git stash

Temporarily save uncommitted changes.

Example: git stash push -m "work in progress"
stash save temporary
git stash pop

Restore and remove most recent stashed changes.

Example: git stash pop
stash restore pop

Remote

git remote -v

Show remote repositories.

Example: git remote -v
list remote
git push origin <branch_name>

Push changes to a remote repository.

Example: git push origin main
push remote
git pull origin <branch_name>

Pull changes from a remote repository.

Example: git pull origin main
pull remote
git fetch

Fetch changes from remote without merging.

Example: git fetch origin
fetch remote
git branch -u origin/<branch>

Set upstream tracking for current branch.

Example: git branch -u origin/main
upstream tracking branch
git fetch --prune

Fetch changes and remove stale remote branches.

Example: git fetch --prune origin
fetch prune cleanup

Analysis

git show <commit>

Display details and changes of a specific commit.

Example: git show abc123
show commit details
git blame <file>

Show who last modified each line of a file.

Example: git blame src/main.js
blame author history
git tag

List all tags in the repository.

Example: git tag --sort=-version:refname
tag list version
git tag <name>

Create a new tag at current commit.

Example: git tag v1.0.0
tag create version

History

git log

Show commit history.

Example: git log --oneline
log history
git diff

Show changes between commits or working directory.

Example: git diff HEAD~1
diff changes
git reset <commit>

Reset to a specific commit.

Example: git reset --hard HEAD~1
reset commit
git revert <commit>

Revert a specific commit.

Example: git revert abc123
revert commit

Kubernetes Commands

Pods

kubectl get pods

List all pods in the current namespace.

Example: kubectl get pods -o wide
list pods namespace
kubectl describe pod <pod-name>

Show detailed information about a specific pod.

Example: kubectl describe pod my-app-pod
describe pod details
kubectl logs <pod-name>

View logs from a specific pod.

Example: kubectl logs -f my-app-pod
logs pod debug
kubectl exec -it <pod-name> -- /bin/bash

Execute commands inside a running pod.

Example: kubectl exec -it my-app-pod -- /bin/bash
exec shell pod

Services

kubectl get services

List all services in the current namespace.

Example: kubectl get svc -o wide
list services networking
kubectl expose deployment <deployment-name> --port=80

Create a service to expose a deployment.

Example: kubectl expose deployment nginx --port=80 --type=LoadBalancer
expose service deployment

Deployments

kubectl get deployments

List all deployments in the current namespace.

Example: kubectl get deployments -o wide
list deployments
kubectl scale deployment <deployment-name> --replicas=3

Scale a deployment to a specified number of replicas.

Example: kubectl scale deployment nginx --replicas=5
scale deployment replicas
kubectl rollout restart deployment/<deployment-name>

Restart a deployment by triggering a rollout.

Example: kubectl rollout restart deployment/nginx
restart rollout deployment