Skip to main content
wp-config.org

Server configuration

Linux commands, explained

A practical command reference for developers and server administrators. Find a task, read what it does, then copy the command you need.

  • 206 commands
  • 23 categories
  • Effect labels

Free, no sign-up. Copying a command never runs it.

Nothing you enter leaves your browser.

This tool runs in your browser and needs JavaScript. Turn JavaScript on and reload the page.

Linux commands

Replace example paths, hostnames, users, process IDs and ports with your own checked values. Each block is a separate example, and copying does not run anything.

Changes state commands can write files or settings. May interrupt service commands need particular care on a live host. Use your normal account unless a command needs sudo, and check local help with man command or command --help.

Showing all 206 commands.

Skip to the end of the results
Browse by task (23 categories)

Shell basics and help

Start here: Bash navigation, help and how commands are resolved.

Print the directory your shell is currently using.

pwd

Relative paths start here.

Change directory

Changes state

Move into an example website directory.

cd /srv/www/example.com

Replace the path with an existing directory.

Previous directory

Changes state

Return to the directory used before the last cd.

cd -

Requires a previous directory in this shell.

Check how the shell resolves the PHP command.

command -v php

A missing command returns a nonzero status.

Show matching aliases, functions and executables.

type -a ls

Useful when an alias changes command behavior.

Read a manual

Inspect

Open the installed chmod documentation.

man chmod

Press q to exit; manuals match installed versions.

Read Bash help for its cd built-in.

help cd

Bash-specific; cd is not an external executable.

Display the status of the immediately preceding command.

printf "Exit status: %s\n" "$?"

Run immediately after the command you are checking.

Command history

Inspect

List the last 25 Bash history entries.

history 25

History may contain secrets; do not publish it.

Files and directories

Browse, create and copy files with explicit paths and interactive overwrite checks.

Show hidden entries, permissions, owners and sizes.

ls -lah -- /srv/www/example.com

The path must exist and be readable.

Create directories

Changes state

Create a project directory and missing parents.

mkdir -p -- ./project/config

Creates directories in your current location.

Create an empty file

Changes state

Create a file or update an existing file timestamp.

touch -- ./notes.txt

An existing file keeps its contents.

Copy with confirmation

Changes state

Copy a configuration, asking before an overwrite.

cp -i -- ./config.conf ./config.conf.backup

Use a private destination if the source contains secrets.

Copy a directory

Changes state

Preserve file attributes while copying a directory.

cp -a -i -- ./site ./site-backup

An existing destination changes where the copy lands; inspect it first.

Move or rename

Changes state

Rename a file, asking before replacing a destination.

mv -i -- ./old-name.txt ./new-name.txt

Moves affect the original path.

Ask before permanently removing one named file.

rm -i -- ./unneeded-file.txt

Deletion has no automatic undo; verify the exact file.

Remove a directory only if it is empty.

rmdir -- ./empty-directory

Fails rather than deleting directory contents.

Resolve a path

Inspect

Print an absolute resolved path.

realpath -- ./config.conf

Symlinks can point somewhere other than expected.

Read and compare text

Inspect logs, configuration and differences without opening an editor.

Print the operating system release information.

cat -- /etc/os-release

Avoid dumping huge files or secrets to shared terminals.

Browse a log without printing it all at once.

less -- /var/log/nginx/access.log

Read permission required; q exits and / searches.

First lines

Inspect

Print the first 30 lines of a text file.

head -n 30 -- ./config.conf

Replace the example filename.

Last lines

Inspect

Print the latest 50 log lines.

tail -n 50 -- /var/log/nginx/error.log

The path and log permissions vary by server.

Follow updates and retry if log rotation replaces the file.

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

Press Ctrl+C to stop following.

Number lines

Inspect

Print text with line numbers, including blank lines.

nl -ba -- ./config.conf

Output is a display, not a file modification.

Count text

Inspect

Count lines, words and bytes.

wc -l -w -c -- ./access.log

Byte count is not necessarily character count.

Show a unified text diff.

diff -u -- ./before.conf ./after.conf

Exit status 1 means differences, not an execution failure.

Inspect file signatures and report a likely type.

file -- ./download.bin

A type guess does not prove a file is safe.

Find files and text

Use bounded paths and quoted patterns; review matches before making changes.

Find matching filenames beneath the website parent.

find /srv/www -type f -name "wp-config.php" -print

Traversal requires permissions and may take time.

List directories named cache.

find ./project -type d -name "cache" -print

This only lists matches; it does not remove anything.

List files modified within roughly the last hour.

find ./project -type f -mmin -60 -print

Modification time is not a complete audit trail.

Large files

Inspect

List files larger than 100 MiB within this filesystem.

find /var/log -xdev -type f -size +100M -print

Some log directories require additional read access.

Find a literal string and show matching line numbers.

grep -nF -- "DB_HOST" ./wp-config.php

Matching lines may contain credentials.

Search text configuration files recursively.

grep -RIn --include="*.conf" -- "server_name" ./config

Symlinks are followed by -R; limit the starting directory.

Match either error or warning.

grep -nE -- "error|warning" ./app.log

Patterns are case-sensitive unless -i is added.

Count lines containing an example status marker.

grep -cF -- " 404 " ./access.log

Confirm the actual log format before interpreting counts.

Count lines safely when filenames contain spaces.

find ./project -type f -name "*.txt" -print0 | xargs -0 -r wc -l --

GNU xargs -r skips execution when no files match.

Text processing and pipelines

Transform output without changing source files; redirect only when you intend to write.

Sort lines

Inspect

Print lines in sorted order.

sort -- ./names.txt

Locale affects ordering; the source file is unchanged.

Count duplicates and put frequent values first.

sort -- ./names.txt | uniq -c | sort -nr

uniq needs equal lines grouped together.

Print fields one and three from simple delimiter-separated data.

cut -d "," -f 1,3 -- ./simple.csv

Not suitable for quoted CSV containing embedded commas.

Print lines 10 through 25.

sed -n "10,25p" ./config.conf

No in-place editing flag is used.

Print a replacement preview to standard output.

sed "s/old.example/new.example/g" ./config.conf

This example does not modify the source.

Add values in the first whitespace-separated column.

awk '{total += $1} END {print total}' ./numbers.txt

Assumes numeric input in column one.

Print a lowercase version of the input.

printf "%s\n" "Example" | tr "[:upper:]" "[:lower:]"

Text is piped directly; no file is written.

Validate JSON

Inspect

Parse and pretty-print JSON.

python3 -m json.tool ./data.json

Requires Python 3; avoid printing private JSON publicly.

Write a pipeline result

Changes state

Display matches and save them to a review file.

grep -nF -- "ERROR" ./app.log | tee ./errors-review.txt

tee overwrites its destination unless -a is used.

Ownership and permissions

Apply permissions to individual known files; avoid blanket recursive changes.

Show owner, permission bits, size and timestamps.

stat -- ./config.conf

Timestamps do not prove who changed a file.

Show permissions and owners along a path.

namei -l /srv/www/example.com/public/index.html

Requires namei, commonly supplied by util-linux.

Private file permissions

Changes state

Allow only the owner to read and write this file.

chmod 600 -- ./private.conf

Verify the service user can still access what it needs.

Make a script executable

Changes state

Add execute permission for the file owner.

chmod u+x -- ./maintenance.sh

Review script contents before executing it.

Set a file owner

Changes state

Change owner and group on one configuration file.

sudo chown deploy:www-data -- ./config.conf

Replace both accounts; do not assume these match your host.

Show the current shell file-creation mask.

umask

This affects new files, not existing permissions.

Private creation mask

Changes state

Restrict newly created files in the current shell.

umask 077

Some programs choose additional permissions explicitly.

Show extended access-control entries.

getfacl -- ./shared-directory

Requires the acl package; filesystem support varies.

Create a symbolic link

Changes state

Create a link to an example relative target.

ln -s -- ./releases/current ./current-release

Relative targets are resolved from the link location.

Users, groups and sudo

Inspect identity and review account changes before applying them.

Print your effective username.

whoami

sudo can change the effective account.

Show your user ID and group memberships.

id

Useful when troubleshooting file access.

Show groups for an example account.

groups deploy

Replace deploy with a real account.

Read an account entry from configured identity sources.

getent passwd deploy

An empty result may mean the account does not exist.

List current login sessions.

who

Results depend on session accounting.

List commands your account is permitted to run through sudo.

sudo -l

May ask for your password.

Create a user

Changes state

Interactively create an Ubuntu/Debian user.

sudo adduser deploy

Review account policy and use a unique username.

Append one group without replacing other memberships.

sudo usermod -aG www-data deploy

New sessions may be needed; verify the group is appropriate.

Change your password

Changes state

Interactively change your account password.

passwd

Type passwords at the prompt, never as shell arguments.

System information and resources

Inspect the host, CPU, memory and time before tuning anything.

Read the distribution name and release fields.

cat /etc/os-release

Distribution version differs from kernel version.

Show kernel and machine information.

uname -a

May expose host details in shared output.

Show hostname and system information on systemd hosts.

hostnamectl

Some containers do not run systemd.

Uptime and load

Inspect

Show uptime and recent system load averages.

uptime

Load includes runnable and certain blocked tasks.

Memory summary

Inspect

Show memory and swap with readable units.

free -h

Available memory is more informative than unused memory alone.

CPU layout

Inspect

Show CPU architecture and topology.

lscpu

Virtual machines may expose only virtual CPU details.

Show processing units available to the current process.

nproc

Container limits can differ from physical host capacity.

Print local time and UTC.

date --iso-8601=seconds
date -u --iso-8601=seconds

Both lines inspect time; neither changes the clock.

Inspect timezone and synchronization state.

timedatectl status

Requires a compatible systemd environment.

Processes and performance

Observe first; terminating or reprioritizing processes can affect live requests.

Show processes ranked by memory percentage.

ps aux --sort=-%mem | head -n 15

A snapshot does not measure sustained pressure.

Show processes ranked by reported CPU usage.

ps aux --sort=-%cpu | head -n 15

ps CPU values are not the same as an instant sampling monitor.

List process IDs and full commands matching Nginx.

pgrep -af nginx

Command lines can contain sensitive arguments.

Process tree

Inspect

Show parent and child processes with IDs.

pstree -p

May require the psmisc package.

I/O sampling

Inspect

Show extended device statistics over three reports.

iostat -xz 1 3

Requires sysstat; the initial report is since boot.

Inspect one example process before acting on it.

ps -p 12345 -o pid,ppid,user,stat,etime,args

Replace 12345 with a verified current process ID.

Request process termination

May interrupt service

Ask a known process to terminate gracefully.

kill -TERM 12345

Recheck PID and ownership; prefer systemctl for managed services.

Disk space and filesystems

Diagnose space, inode and mount problems without formatting or repartitioning.

Show mounted filesystem types and space use.

df -hT

Filesystem space and directory totals measure different things.

Inode capacity

Inspect

Show inode use on mounted filesystems.

df -i

A filesystem can run out of inodes before bytes.

Directory total

Inspect

Estimate disk use beneath one directory.

du -sh -- /srv/www/example.com

Traversal may be slow and permissions may hide files.

Compare immediate subdirectories without crossing filesystems.

du -xhd1 -- /var | sort -h

GNU du options; unreadable directories produce errors.

Block devices

Inspect

List block devices and mount locations.

lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINTS

Read-only inventory; it does not mount or format devices.

Mount inventory

Inspect

Show mounted filesystems as a tree.

findmnt

Available fields vary by util-linux version.

Find the filesystem covering a directory.

findmnt -T /srv/www

Useful before assuming which device is full.

List open files whose directory links were removed.

sudo lsof +L1

Requires lsof; do not restart services without assessing impact.

Inspect filesystem UUIDs and type signatures.

sudo blkid

Read-only probing may require administrator access.

Archives and checksums

List archive contents before extracting, and protect backups that contain secrets.

List the archive members without extracting them.

tar -tzf ./site-backup.tar.gz

Inspect unexpected paths before extracting untrusted archives.

Archive an example website directory.

tar -czf ./site-backup.tar.gz -C /srv/www example.com

Writes an archive; coordinate consistency for live data.

Extract into a review directory without restoring original ownership.

mkdir -p ./restore-review && tar -xzf ./site-backup.tar.gz -C ./restore-review --no-same-owner

Use only a trusted archive; extraction can overwrite files.

Inspect names and sizes in a ZIP file.

unzip -l ./plugin.zip

Requires unzip; listing does not prove the archive is safe.

Extract into a review directory, preserving existing files.

unzip -n ./plugin.zip -d ./plugin-review

Review names and trust the source before extraction.

Create a ZIP archive

Changes state

Package a project directory as ZIP.

zip -r ./project.zip ./project

Requires zip; avoid accidentally including credentials.

Calculate the file checksum.

sha256sum -- ./download.tar.gz

Compare against a trusted independent published digest.

Check files against a trusted digest list.

sha256sum -c ./SHA256SUMS

The checksum list itself must be authentic.

Check gzip stream integrity without extraction.

gzip -t ./site-backup.tar.gz

This does not validate the backup contents or application consistency.

Rsync and remote transfers

Preview synchronization before writing; examples do not delete destination files.

Dry-run a directory-content synchronization.

rsync -avhn -- ./site/ ./backup/

The trailing slash copies contents rather than the directory itself.

Copy with rsync

Changes state

Copy local contents and preserve supported archive attributes.

rsync -avh -- ./site/ ./backup/

Can replace destination files; review a dry run first.

Preview an upload over SSH.

rsync -avhn -e "ssh -p 22" -- ./site/ deploy@example.com:/srv/www/example.com/

Replace the host, user, port and path; requires remote rsync.

Upload over SSH

Changes state

Upload a site directory over SSH.

rsync -avh -e "ssh -p 22" -- ./site/ deploy@example.com:/srv/www/example.com/

Can overwrite remote files; verify host identity and preview first.

Copy one file remotely

Changes state

Copy a local file to an example remote location.

scp -P 22 ./config.conf deploy@example.com:/srv/config-review.conf

May overwrite a remote file; confirm destination and permissions.

Download one remote file

Changes state

Copy a remote report to your machine.

scp -P 22 deploy@example.com:/srv/report.txt ./report.txt

May overwrite the local destination; verify the source host.

Interactive SFTP

Changes state

Open an encrypted file-transfer session.

sftp -P 22 deploy@example.com

Commands such as put and rm inside the session change files.

Compare contents by checksum during a dry run.

rsync -avhnc -- ./site/ ./backup/

Reads file contents on both sides and can be slower.

Interfaces, routes and sockets

Inspect the local network and test reachability only to systems you may contact.

Show network interfaces and IP addresses concisely.

ip -br address

Requires the iproute2 utilities.

Routing table

Inspect

Show IPv4 routes and the default gateway.

ip route show

Use ip -6 route show for IPv6 routes.

Ask the kernel which route it would use.

ip route get 1.1.1.1

A route lookup does not prove end-to-end connectivity.

Show listening sockets and available process information.

sudo ss -lntup

Administrator access exposes other users’ process details.

List established TCP sockets numerically.

ss -tn state established

Connection lists can contain private peer addresses.

Socket summary

Inspect

Show aggregate socket statistics.

ss -s

Counts are a snapshot, not a traffic history.

Ping a host

Inspect

Send four ICMP echo requests.

ping -c 4 example.com

ICMP may be filtered even when a website works.

Estimate the route and path MTU.

tracepath example.com

Requires tracepath; devices may suppress replies.

Show per-interface packet and error counters.

ip -s link show

Counters need interval comparisons to diagnose a trend.

DNS, HTTPS and certificates

Check name resolution and HTTP/TLS behavior with bounded requests.

Query IPv4 address records using the configured resolver.

dig +short example.com A

Requires dnsutils on Ubuntu.

Mail records

Inspect

Inspect mail-exchanger answers and DNS response metadata.

dig example.com MX

A DNS answer is not a mail delivery test.

TXT records

Inspect

Read public TXT records such as SPF and verification tokens.

dig example.com TXT

Large answers may include unrelated TXT values.

List nameserver answers.

dig +short example.com NS

Cached responses can differ during a DNS change.

Ask a specific resolver for IPv6 address records.

dig @1.1.1.1 example.com AAAA

This sends the queried name to that resolver.

Inspect systemd-resolved links and DNS settings.

resolvectl status

Applies only when systemd-resolved is in use.

Issue a bounded HEAD request and show headers.

curl -sS -I --connect-timeout 5 --max-time 15 https://example.com/

HEAD behavior can differ from GET responses.

Follow up to five redirects while inspecting headers.

curl -sS -I -L --max-redirs 5 --connect-timeout 5 --max-time 20 https://example.com/

Review redirect targets; this sends requests to them.

Inspect a TLS handshake with hostname verification.

timeout 15s openssl s_client -connect example.com:443 -servername example.com -verify_hostname example.com -verify_return_error </dev/null

Requires GNU timeout, OpenSSL and a configured trust store; not a full TLS audit.

SSH access and keys

Use verified host keys and keep private keys private.

Connect with SSH

Changes state

Open a remote shell as an example account.

ssh -p 22 deploy@example.com

Verify the fingerprint through a trusted channel before accepting it.

Choose a private key

Changes state

Connect using a specific existing key.

ssh -i ~/.ssh/id_ed25519 -p 22 deploy@example.com

Never upload or disclose the private key.

Create an Ed25519 key

Changes state

Generate a separate SSH keypair interactively.

ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_example -C "example-server"

Choose a passphrase and do not overwrite an existing key.

Show the fingerprint of a public key.

ssh-keygen -lf ~/.ssh/id_ed25519_example.pub

A public fingerprint is not the private key.

Install a public key

Changes state

Append your public key to a remote account.

ssh-copy-id -i ~/.ssh/id_ed25519_example.pub deploy@example.com

Verify the remote host first; requires an existing access method.

Debug a connection

Changes state

Connect with verbose diagnostics.

ssh -vv -o ConnectTimeout=10 deploy@example.com

Logs can reveal usernames, paths and server details.

Print evaluated client configuration without connecting.

ssh -G example.com

This is client configuration, not the server sshd configuration.

Check sshd configuration syntax and key availability.

sudo sshd -t

Do this before any reload; keep a working access session.

Show fingerprints available from your running SSH agent.

ssh-add -l

Requires a reachable agent; it does not show private key material.

Ubuntu and Debian packages

APT examples target Ubuntu/Debian; other distributions use different package managers.

Refresh package indexes

Changes state

Refresh repository package metadata.

sudo apt update

Changes local package indexes; does not upgrade packages.

Show installed packages with candidate upgrades.

apt list --upgradable

Refresh indexes first for current repository information.

Find repository packages matching a search term.

apt search nginx

Search results depend on enabled repositories.

Read package metadata and dependencies.

apt show nginx

Does not prove which variant your host should install.

Preview package actions without installing Nginx.

apt-get -s install nginx

Simulation is not an availability or deployment guarantee.

Install a package

Changes state

Install Nginx and required dependencies after review.

sudo apt install nginx

Package hooks may start services or alter configuration.

Preview upgrade actions.

apt-get -s upgrade

Actual transactions can change after metadata or package state changes.

Upgrade installed packages

May interrupt service

Apply available upgrades after confirmation.

sudo apt upgrade

May restart services; review maintenance needs and backups.

List paths installed by an example package.

dpkg -L nginx-common

The package name must be installed.

Systemd services and firewall

Inspect unit names and existing firewall policy before making service changes.

Service status

Inspect

Show Nginx state and recent journal entries.

systemctl status nginx --no-pager

Nonzero status can indicate an inactive service.

Print whether the unit is active.

systemctl is-active nginx

A running process alone does not prove application health.

Failed units

Inspect

List failed systemd units.

systemctl --failed --no-pager

Investigate the journal before restarting repeatedly.

Show unit files and drop-in configuration.

systemctl cat nginx

Check for secrets before sharing the output.

Reload Nginx after validation

May interrupt service

Apply a supported reload only after a successful syntax check.

sudo nginx -t && sudo systemctl reload nginx

Affects live service configuration; confirm the correct host.

Restart a service

May interrupt service

Stop and start Nginx.

sudo systemctl restart nginx

Can interrupt active connections; use a maintenance window.

Reread unit definitions

Changes state

Reread changed systemd unit files and drop-ins.

sudo systemctl daemon-reload

Does not restart affected services by itself.

Firewall rules

Inspect

Show UFW status and numbered rules.

sudo ufw status numbered

UFW may not be the active firewall manager.

Preview allowing inbound TCP port 443.

sudo ufw --dry-run allow 443/tcp

Does not apply the rule; check provider firewalls separately.

Logs and troubleshooting

Bound log output and avoid publishing credentials, user data or private request URLs.

Show the latest 100 accessible entries from this boot.

journalctl -b -n 100 --no-pager

System-wide logs may require extra permissions.

Show recent entries for a unit.

journalctl -u nginx -n 100 --no-pager

Some Nginx logs are files rather than journal entries.

Recent errors

Inspect

Show recent entries at error priority or more severe.

journalctl -p err --since "1 hour ago" --no-pager

Applications must use journal priorities consistently.

Stream new entries for Nginx.

journalctl -fu nginx

Ctrl+C stops the viewer.

Read the previous boot when retained.

journalctl -b -1 -n 100 --no-pager

Requires persistent or otherwise retained previous-boot records.

Show space used by archived and active journal files.

journalctl --disk-usage

This does not remove journal data.

Kernel messages

Inspect

Show the tail of the kernel message buffer.

sudo dmesg --human | tail -n 60

Access may be restricted and messages may reveal host details.

Read rotation configuration and print debug decisions.

sudo logrotate --debug /etc/logrotate.conf

Debug mode does not rotate logs or update its state file.

Last boot time

Inspect

Show the recorded system boot time.

who -b

Depends on system accounting records.

Cron, timers and shell scripts

Schedules need a known timezone, execution account, environment and logging strategy.

Your crontab

Inspect

List the current account cron entries.

crontab -l

A missing crontab may return a nonzero status.

Edit your crontab

Changes state

Open the current account crontab in an editor.

crontab -e

Saving changes affects scheduled jobs; review user and timezone.

Inspect system cron locations.

ls -l /etc/cron.d /etc/cron.daily /etc/cron.weekly

File format differs from a user crontab.

Systemd timers

Inspect

Show active and inactive timer schedules.

systemctl list-timers --all --no-pager

Timers are separate from cron jobs.

Parse a Bash script without executing it.

bash -n ./maintenance.sh

A syntax pass does not prove correctness or safety.

Run a reviewed script

Changes state

Run a script with Bash.

bash ./maintenance.sh

Inspect the script and test on staging first.

Treat text containing spaces as one argument.

printf "%s\n" "a filename with spaces.txt"

Double quotes still expand variables and command substitutions.

Print executable search directories.

printf "%s\n" "$PATH"

Do not add untrusted writable directories to PATH.

Set one variable only for a reviewed child command.

APP_ENV=staging bash ./maintenance.sh

This runs the script; use only non-secret values in shell history.

Nginx and PHP operations

Paths, service names, sockets and PHP versions differ between hosting environments.

Check syntax and whether required configuration files can be opened.

sudo nginx -t

No reload is performed.

Validate and dump the loaded Nginx configuration.

sudo nginx -T

Output may contain upstream credentials or other sensitive settings.

Show build configuration and enabled compiled features.

nginx -V

Output is written to standard error.

PHP CLI version

Inspect

Show the PHP binary used by your shell.

php -v

CLI and PHP-FPM may use different versions or configuration.

List loaded CLI PHP modules.

php -m

Check the FPM runtime separately for web requests.

Lint one PHP file without running its application code.

php -l ./plugin.php

Lint does not validate WordPress hooks or runtime dependencies.

List matching FPM units.

systemctl list-units --type=service --all "php*-fpm.service" --no-pager

Use the actual unit name rather than guessing a PHP version.

Inspect one HTTP response and timing sample.

curl -sS -o /dev/null --connect-timeout 5 --max-time 20 -w 'status=%{http_code} connect=%{time_connect}s first_byte=%{time_starttransfer}s total=%{time_total}s\n' https://example.com/

One request is not a reliable performance benchmark.

MariaDB, MySQL and Redis

Use restricted accounts, interactive passwords and private backup locations.

Show the installed MariaDB client version.

mariadb --version

Client version is not necessarily the server version.

Connect and query the server version.

mariadb -u app_user -p -e "SELECT VERSION();"

Replace the user; -p prompts rather than exposing a password.

Database list

Inspect

List databases visible to your account.

mariadb -u app_user -p -e "SHOW DATABASES;"

Permissions limit which names are visible.

Inspect visible database sessions.

mariadb -u app_user -p -e "SHOW PROCESSLIST;"

Queries and connection metadata can contain private information.

Transactional SQL backup

Changes state

Write a private logical database backup.

umask 077; mariadb-dump -u backup_user -p --single-transaction --quick --databases wordpress > ./wordpress-backup.sql

Overwrites the destination; consistency assumes transactional tables and no conflicting DDL. The umask 077 also applies to the rest of this shell session. Backups need tested restores.

Ask a local Redis endpoint to reply.

redis-cli -h 127.0.0.1 -p 6379 PING

Unauthenticated example; use your configured socket/TLS/ACL settings.

Inspect memory statistics using an interactive password prompt.

redis-cli --user app_user --askpass -h 127.0.0.1 INFO memory

Requires compatible redis-cli and ACL permissions; no password in arguments.

Redis slow log

Inspect

Inspect a bounded set of recent slow operations.

redis-cli -h 127.0.0.1 SLOWLOG GET 10

Arguments may contain private data; credentials may be required.

Redis key scan

Inspect

Request one incremental batch of matching key names.

redis-cli -h 127.0.0.1 SCAN 0 MATCH "wp:*" COUNT 100

COUNT is a hint; use the returned cursor until zero for a full iteration.

Git inspection and deployment

Keep local work safe and review changes before updating a live checkout.

Show branch state and changed paths.

git status --short --branch

Untracked files are not part of commits until added.

Show local unstaged edits in one path.

git diff -- ./config.conf

Does not include staged changes.

Show changes prepared for the next commit.

git diff --cached

Check for accidentally staged secrets.

Recent commits

Inspect

Show a compact recent history.

git log -n 10 --oneline --decorate

Commit messages are descriptions, not proof of deployment.

List configured fetch and push URLs.

git remote -v

URLs may contain private repository information.

Fetch remote state

Changes state

Download remote objects and update tracking references.

git fetch origin

Does not update working-tree files; still changes local Git state.

List fetched commits not in the current HEAD.

git log --oneline HEAD..origin/main

Replace main if your deployment uses a different branch.

Fast-forward update

Changes state

Update from main only when a fast-forward is possible.

git pull --ff-only origin main

Review local status and backups first; hooks or deployed code may affect production.

Commit one reviewed file

Changes state

Stage one file and commit the prepared index.

git add -- ./config.conf && git commit -m "Update configuration"

Any other staged files also enter this commit; review git diff --cached first.

WordPress and WP-CLI checks

Run as the website owner from the correct installation; avoid running WordPress as root.

Inspect the CLI binary and PHP environment.

wp --info

Requires WP-CLI installed on your command path.

Show the WordPress version in an example installation.

wp --path=/srv/www/example.com/public core version

Replace the path with your actual WordPress root.

List installed plugins and update metadata.

wp --path=/srv/www/example.com/public plugin list

WordPress bootstrap can load application code and contact services.

Theme inventory

Inspect

List installed themes.

wp --path=/srv/www/example.com/public theme list

Requires access to the installation and its database.

Compare core files against official published checksums.

wp --path=/srv/www/example.com/public core verify-checksums

Contacts WordPress.org; not a complete malware or custom-code audit.

Site URL

Inspect

Read the stored WordPress site URL.

wp --path=/srv/www/example.com/public option get siteurl

Multisite context may require an explicit --url value.

List WordPress cron events.

wp --path=/srv/www/example.com/public cron event list

WP-Cron is distinct from the host cron scheduler.

Preview a WordPress-aware database replacement.

wp --path=/srv/www/example.com/public search-replace "https://old.example" "https://new.example" --skip-columns=guid --dry-run

Requires a current backup; dry run can still bootstrap plugins and read many tables.

List database tables for this WordPress configuration.

wp --path=/srv/www/example.com/public db tables

Database access and the correct site context are required.

End of the commands.

What you can do

  • Search commands by task, keyword or syntax

  • Category and effect filters

  • A copy button and a link for every command

  • Ubuntu, Bash, web server and WordPress examples

  • Explanations, requirements and official references

How to use it

  1. Find the command

    Search by task or command name and narrow the list with the category and effect filters.

  2. Read the explanation

    Read what the command does and what it needs. Replace the example values with paths, hosts and accounts you have checked.

  3. Copy and review

    Copy one block, review it in your terminal and run it only when it suits your own system.

Find a command and understand its effect

Use this Linux command cheat sheet as a reference by task. The examples cover the shell, files, system checks, networking, deployment and a WordPress server stack. They are separate examples, not one installation script.

Know the limits

General examples assume Bash and the GNU tools. Package commands are for Ubuntu and Debian, and systemd, service names and installed programs vary. The page does not run commands or contact your server. An "Inspect" label describes the intended effect, not a promise of no side effects. Review the change and your backups before you change a live system.

Official documentation and local help

These are practical examples rather than every command or option on Linux. The manuals installed on your server are the best reference for your exact versions. Some programs need a package installed first, and service names and hosting paths vary.

Linux command questions

Do these buttons run commands on my server?

No. Copy buttons put only the command text on your clipboard. Nothing connects to your server or runs a command; you choose whether to run it in your own terminal.

Will every command work on every Linux distribution?

No. General examples assume Bash and the common GNU tools. APT examples are for Ubuntu and Debian, and systemctl and journalctl need systemd. Check your installed manual pages, package names and service names before you use them.

What do the effect labels mean?

"Inspect" means the example mainly reads information, although it may use the network, create temporary files or load application code. "Changes state" means it can write files, change accounts or settings, or open a session that can. "May interrupt service" marks actions such as a restart or stopping a process.

Should I run every command with sudo?

No. Use your normal account by default, and use sudo only for a task that needs it, after checking the command and its target. Run WP-CLI as the website owner, not as root.

How do I use the example paths and host names?

Replace example.com, example file names, accounts, ports, service names and process IDs with values you have checked. Put quotes around paths that contain spaces. Each example stands alone, so do not paste the whole page as a script.

Why can a command return a non-zero exit status without a fault?

Some commands use a non-zero status for normal results: diff returns 1 when files differ, grep returns 1 when nothing matches, and service checks return non-zero for a stopped service. Read the manual and the output before you treat a status as a failure.

What if copying does not work?

The page selects the command text so you can use your device's normal Copy action, and you can always select a code block by hand. All the command text stays readable with JavaScript turned off.

Does this replace a backup or a security audit?

No. Commands need checking for your own machine and permissions. Keep backups you can restore, test restores and review changes on staging. A passing syntax check, checksum or single timing does not prove security or production speed.

Related tools

  • WP-CLI commands

    Build installation and maintenance commands.

  • Nginx

    Prepare routing, HTTPS and cache configuration.

  • Cron jobs

    Build schedules and preview upcoming runs.

  • PHP extensions

    Choose PHP extensions and runtime settings.