Skip to content

Archive

Linux

46 articles
Linux Updated 02 Sep 2025 2 min read

Find the Most Resource-Intensive Processes on Linux

When a Linux system feels slow, a small number of processes may be consuming most of the CPU, memory, or disk I/O. Several standard tools help identify them quickly. Highest CPU Usage with ps ps aux --sort=-%cpu | head For more rows:

Linux Updated 02 Sep 2025 2 min read

Find Recently Changed Files on Linux

Linux provides several ways to find files that were modified recently or to watch a directory for changes as they happen. Files Modified in the Last Hour find /path/to/directory -type f -mmin -60 -mmin works in minutes.

Linux Updated 02 Sep 2025 1 min read

Display a Directory Tree on Linux

A directory tree makes project and filesystem structure easier to understand than a flat list of paths. The dedicated tree utility is usually the clearest tool for this job. Use tree tree Example output:

Linux Updated 02 Sep 2025 2 min read

Create Cron Jobs on Linux

Cron is a time-based scheduler commonly used on Linux and Unix-like systems. It can run backups, cleanup scripts, reports, maintenance commands, and other recurring tasks automatically. Cron Syntax A user crontab entry has five schedule fields followed by the command: * * * * * /path/to/command - - - - - | | | | | | | | | +----- day of week (0-7, Sunday=0 or 7) | | | +------- month (1-12) | | +--------- day of month (1-31) | +----------- hour (0-23) +------------- minute (0-59) Edit Your User Crontab crontab -e For example, run a backup every day at 02:30:

Linux Updated 02 Sep 2025 2 min read

Create and Manage Symbolic Links on Linux

A symbolic link, or symlink, is a special filesystem entry that stores a path to another file or directory. Symlinks are useful for shortcuts, shared configuration, version switching, and keeping one canonical copy of data. Create a Symlink ln -s TARGET LINK_NAME Link to a file:

Linux Updated 02 Sep 2025 2 min read

Count Files in a Linux Directory Quickly

Counting files is useful in shell scripts, backups, log maintenance, migration checks, and filesystem monitoring. The right command depends on whether you want only regular files, recursive results, hidden files, directories, or symbolic links. Count Regular Files in One Directory With GNU find: find /path/to/directory -maxdepth 1 -type f -printf '.' | wc -c -maxdepth 1 prevents recursion into subdirectories. Hidden files are included automatically.

Linux Updated 02 Sep 2025 2 min read

Compress and Extract Files Quickly on Linux

Linux provides several standard compression tools. Some compress a single file, while tar combines many files into one archive and can apply compression at the same time. gzip gzip filename gunzip filename.gz gzip is widely available and usually a good balance between speed and compression ratio.

Cloud Computing Updated 02 Sep 2025 2 min read

Using Nginx as a Reverse Proxy for a Go Application

A Go web application often listens directly on an application port such as :8080. If you want users to access it through a normal domain on port 80 or 443, you can place Nginx in front of it as a reverse proxy. Using Nginx in front of a Go service provides several benefits: Client requests reach Nginx before being forwarded to the Go application. TLS termination can be handled at the proxy layer. Multiple application instances can be load balanced. Static assets can be served separately when that architecture makes sense. This guide shows a basic setup.

Linux Updated 02 Sep 2025 2 min read

Uploading and Downloading Files over SSH on Linux

SSH is commonly used for remote shell access, but the same secure connection can also transfer files. The scp command provides a straightforward way to copy individual files or directories between a local machine and an SSH server. 1. Prerequisites Before using scp, make sure: You can connect to the server with SSH. You know the remote username and hostname or IP address. The destination path is writable by that user. Your SSH key or other authentication method is configured. 2. Upload a File The general form is:

Linux Updated 02 Sep 2025 3 min read

Managing Users on Linux: A Practical Guide

Linux user management controls who can sign in, which files they can access, and which administrative actions they can perform. A few standard commands cover most day-to-day account management tasks. 1. Create a User The low-level useradd command creates a new account. A practical invocation is: sudo useradd -m -s /bin/bash -c "John Doe" john The options mean:

Linux Updated 02 Sep 2025 2 min read

Understand and Use `htop` Effectively

htop is an interactive process monitor for Linux and other Unix-like systems. It presents CPU, memory, swap, load, and process information in a navigable terminal interface. Install and Run Debian/Ubuntu: sudo apt install htop Fedora and many RHEL-family systems:

Linux Updated 07 Sep 2025 2 min read

Read and Use `top` on Linux

top is a standard Linux tool for viewing system load and processes in real time. It is useful when diagnosing high CPU use, memory pressure, runaway processes, or general server load. Start top top The display has a system summary at the top and a process table below it.

Linux Updated 02 Sep 2025 1 min read

Monitor Linux Processes with `ps`

ps (process status) prints a snapshot of processes. Unlike top or htop, it does not continuously refresh, which makes it particularly useful in shell pipelines, scripts, and one-time diagnostics. Current Terminal Processes ps All Processes ps -e ps -ef ps -ef uses a Unix-style full-format listing with fields such as UID, PID, PPID, and command.

Linux Updated 07 Sep 2025 2 min read

Search Text with `grep` and Regular Expressions on Linux

grep can search for literal text or regular-expression patterns. With extended regular expressions, it becomes a compact tool for locating structured values, alternatives, prefixes, suffixes, and other text patterns. Extended Regular Expressions Use -E: grep -E 'regex_pattern' file Single quotes are often convenient in the shell because they prevent accidental expansion of regex metacharacters by the shell itself.

Linux Updated 02 Sep 2025 1 min read

Search for Text from the Linux Terminal

grep is one of the standard Linux tools for searching text in files or command output. Search One File grep 'error' application.log Search Several Files grep 'TODO' *.py Ignore Case grep -i 'warning' /var/log/syslog Show Line Numbers grep -n 'function' script.js Search Recursively grep -rI 'main' ./src -r walks subdirectories and -I skips binary files.

Linux Updated 02 Sep 2025 2 min read

Linux File Permissions: A Practical Guide for Developers

Linux file permissions control who can read, modify, or execute files and who can traverse or modify directories. Understanding them is essential for development, deployment, and server administration. Permission Classes Permissions are defined for: user (u) — the file owner; group (g) — users in the file’s group; others (o) — everyone else. The basic permission bits are: read (r); write (w); execute (x). For directories, r allows listing names, w allows creating/removing entries when combined with appropriate access, and x allows traversal.

Linux Updated 02 Sep 2025 2 min read

Finding Files on Linux with `find`

When a directory tree becomes large and deeply nested, searching manually is inefficient. Linux provides the find command for locating files and directories by name, size, type, modification time, and many other properties. 1. Basic Syntax find [path] [expression] path specifies where the search starts. Use . for the current directory. expression defines the filters and actions. 2. Practical Examples Find a File by Name find . -type f -name "example.txt" This searches the current directory and all subdirectories for a regular file named example.txt.

Linux Updated 02 Sep 2025 2 min read

Extract PSD Layers with Bash and ImageMagick

ImageMagick can read many Photoshop PSD files and export the images it exposes as frames or layers. Combined with a Bash loop, this can automate batch extraction without opening every file manually. Install ImageMagick On Debian/Ubuntu: sudo apt install imagemagick ImageMagick 7 uses the magick command. Some older installations expose commands such as convert directly.

Linux Updated 07 Sep 2025 2 min read

Replacing Text in Files with `sed` on Linux

Editing the same text manually across many files is slow and error-prone. The Linux sed stream editor can search, replace, delete, and transform text from the command line. 1. Preview a Replacement Suppose several .txt files contain abc and you want to replace every occurrence with aab: sed 's/abc/aab/g' *.txt Without -i, sed writes the transformed content to standard output and leaves the files unchanged. This makes it useful for previewing a replacement before editing files in place.

Linux Updated 02 Sep 2025 2 min read

Managing Linux Filenames: Replacing Spaces with Underscores

Spaces in filenames are valid on Linux, but they can make shell scripting more cumbersome because paths must be quoted carefully. If a project has a naming convention that prefers underscores, you can rename files in batches with standard shell tools. A Safe Bash Approach The following script recursively finds files whose names contain spaces and replaces those spaces with underscores: find . -type f -name "* *" -print0 | while IFS= read -r -d '' file; do dir=$(dirname -- "$file") base=$(basename -- "$file") new=${base// /_} [ "$base" = "$new" ] || mv -n -- "$file" "$dir/$new" done The important details are:

Linux Updated 02 Sep 2025 2 min read

Monitoring Directory Sizes on Linux with `du` and `sort`

When a Linux server starts running low on disk space, one of the fastest ways to investigate is to find which directories consume the most storage. The du and sort commands work well together for this task. 1. du: Measure Disk Usage du reports how much disk space files and directories use. Two useful options are: -s — show one summary total for each argument instead of every nested item. -h — display sizes in a human-readable format such as KB, MB, or GB. For example:

Linux Updated 02 Sep 2025 2 min read

Synchronizing Files with `rsync` over SSH

rsync is a reliable tool for copying and synchronizing files locally or between machines. When the remote side is accessed through SSH, the transfer is encrypted and can use the same authentication model as normal SSH sessions. Basic Remote Synchronization A common command is: rsync -avP /home/user/documents/ user@example.com:/home/user/backup/ The options are: