Boost Your Linux Workflow: Quick Directory Jump, Vim Tweaks, MySQL Prompt, and System Info Hacks
Learn how to speed up navigation with the "z" command, enhance Vim with a ready-made config, add a clear MySQL prompt, accurately check OS version, and visualize disk usage using concise terminal commands and scripts.
1. Quick Directory Jump with "z"
If you frequently need to cd into deep directories, you can replace repetitive # cd /root/py/auto/fabric commands with the z utility. Clone the script from https://github.com/rupa/z/blob/master/z.sh, place it as z.sh in your home directory, and add source /path/to/z.sh to the end of .bashrc. After reloading the shell, typing z <em>directory_name</em> jumps to any previously visited directory, with the script assigning weights to prioritize frequently used paths.
2. Vim Configuration for a Rich Coding Experience
For developers who spend a lot of time in the terminal editing shell, Python, or C code, a feature‑rich Vim setup can greatly improve productivity. Download the provided Vim configuration archive, extract it into your home directory, and start Vim to enjoy code completion, fast file search, a directory tree, and header file completion for both Python and C.
3. Adding a Descriptive Prompt to MySQL
When connecting to multiple MySQL servers, the default prompt lacks host and user information, which can lead to mistakes. Add the following lines to /etc/my.cnf to customize the prompt:
[mysql]
prompt="\\u@\\h : \\d \\r:\\m:\\s>"After restarting the MySQL client, the prompt will display the current user, host, date, and time.
4. Accurately Determining the System Version
Commonly, users run cat /etc/issue or cat /etc/redhat-release to view the OS version, but these files can be altered or removed. A more reliable method is to use the lsb_release -a command (or hostnamectl on newer systems), which queries the package manager for the official release information.
5. Visualizing Disk Usage
Instead of parsing the output of fdisk or df, you can employ tools like du -h --max-depth=1 combined with sort -hr to get a clear, hierarchical view of disk consumption. The article includes screenshots illustrating the more intuitive output.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
