Speed Up Linux Workflows: Quick Dir Jump, Vim Tweaks, MySQL Prompt & System Info
This guide introduces several handy Linux command-line tricks, including the 'z' shortcut for rapid directory navigation, a feature‑rich Vim configuration, customizing MySQL prompts, reliable methods to display system version details, and concise commands for checking disk usage, helping users streamline their workflow.
1. Quick Jump Command - z
When you frequently need to cd into deep directories, typing the full path each time can be tedious. The 'z' script provides a shortcut. # cd /root/py/auto/fabric Copy the source from https://github.com/rupa/z/blob/master/z.sh into a file named z.sh in your home directory, then add source /path/to/z.sh to the end of your .bashrc. After reloading, you can jump to a previously visited directory by typing z directory_name.
# source z.sh # . .bashrcThe script assigns a weight to each visited directory and selects the most likely target based on that weight.
2. Vim Configuration
If you often edit shell, Python, or C code with Vim, you may want a more powerful interface featuring code completion, fast file search, a directory tree, and header completion for Python and C.
Download the Vim configuration archive, extract it to your home directory, and follow the included instructions to enable the enhancements.
3. Set MySQL Prompt
To distinguish multiple MySQL sessions, add the following line to /etc/my.cnf:
[mysql]
prompt="\\u@\\h : \\d \\r:\\m:\\s>"Reconnect to MySQL to see the new prompt.
4. View System Version
Common methods like cat /etc/issue may expose system details. A more reliable way is to use the following command: # cat /etc/*release CentOS installations also include a centos-release-<version> RPM package.
5. Check Disk Usage
Instead of the basic fdisk or df commands, you can use the following concise command to view disk usage more intuitively:
# lsblk -fSigned-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.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
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.
