Operations 5 min read

Supercharge Linux: z Shortcut, Vim Config, MySQL Prompt & System Info Hacks

This guide shares practical Linux tips—including a fast directory‑jumping z command, a feature‑rich Vim configuration, MySQL prompt customization, reliable system version checks, and intuitive disk‑usage commands—to streamline daily sysadmin workflows.

ITPUB
ITPUB
ITPUB
Supercharge Linux: z Shortcut, Vim Config, MySQL Prompt & System Info Hacks

1. Quick directory navigation with z

The z script records each directory you cd into, assigns a weight based on how often and how recently the directory is visited, and lets you jump to a previously visited directory with z keyword. To install, download the script from its repository (https://github.com/rupa/z/blob/master/z.sh) and save it as ~/z.sh. Then source it from your shell startup file, e.g. add the line: # source ~/z.sh Reload the shell (e.g. . .bashrc) and use z proj to change to a directory whose path contains the string proj that you have visited before.

2. Vim configuration for development

Download a pre‑made Vim configuration archive, extract it into the user’s home directory and use the provided .vimrc. The configuration adds code completion, fast file searching, a directory‑tree view, and header‑file completion for C and Python, giving a richer coding experience in the terminal.

3. MySQL prompt customization

When working with multiple MySQL servers, the default client prompt does not show host or user information. Add the following lines to /etc/my.cnf (or the client‑specific config file) to display user, host, date and time in the prompt:

[mysql]
prompt="\\u@\\h : \\d \\r:\\m:\\s>"

Restart the MySQL client to see the new prompt.

4. Reliable system version detection

Files such as /etc/issue or /etc/redhat-release can be altered or removed, making them unreliable for identifying the OS version. The most accurate method on CentOS is to query the package manager for the installed centos-release RPM: # rpm -q centos-release This returns the full package name, e.g. centos-release-6.8-0.1.el6.centos.x86_64, which precisely indicates the distribution and version.

5. Visual disk‑usage inspection

Instead of parsing the output of fdisk or df, a visual command can be used to display partitions and their usage percentages in a compact, colour‑coded table, making large partitions easy to spot at a glance. The command (shown in the accompanying image) provides a more intuitive overview of disk usage than the traditional text utilities.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxSysadminVimBashcommand-line
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.