Boost Your Linux Productivity with 4 Powerful Command‑Line Tricks
This guide presents four practical Linux techniques—including fast directory navigation with the bd command, advanced cd shortcuts, multi‑terminal management with Terminator, and custom shell scripts—to streamline development workflows and enhance overall efficiency.
Linux has become the most popular operating system among developers, and this article introduces four highly useful tricks to improve work efficiency and comfort on Linux.
1. Elegant and Smooth Directory Switching
1.1 bd command
The bd command lets you quickly jump to a specific parent directory without typing long cd ../../.. sequences. Example: bd python You can also type a few letters to match the nearest directory: bd p Installation:
sudo wget --no-check-certificate -O /usr/bin/bd https://raw.githubusercontent.com/vigneshwaranr/bd/master/bd
sudo chmod +rx /usr/bin/bd
echo 'alias bd=". bd -si"' >> ~/.bashrc
source ~/.bashrc1.2 Common cd shortcuts
Running cd without arguments returns to the home directory ( cd ~). cd - returns to the previous directory.
1.3 Custom commands for frequent directories
Define an alias such as cl to jump directly to a frequently used path by adding it to ~/.bashrc:
echo 'alias cl="cd /home/radia/work/linux/linux-3.16.6"' >> ~/.bashrc
source ~/.bashrc2. Multi‑Terminal Operations
Split the terminal screen into multiple windows to reduce mouse usage. Terminator is recommended.
Installation: sudo apt-get install terminator Key shortcuts include CTRL+SHIFT+↑ ↓ ← → for resizing panes, CTRL+SHIFT+T for new tabs, and ALT+↑ ↓ ← → for switching between panes.
3. File Editing
3.1 Markdown editor recommendation
Typora provides a beautiful, powerful Markdown editing experience.
wget -qO - https://typora.io/linux/public-key.asc | sudo apt-key add -
sudo add-apt-repository 'deb https://typora.io/linux ./'
sudo apt-get update
sudo apt-get install typora3.2 Vim configuration
A ready‑made Vim configuration can be installed with:
sudo apt-get install vim
wget https://pan.baidu.com/s/1opcy7owSzThNmF04aMF3Ow -O vim-config.tar.gz
tar -xvf vim-config.tar -C ~/
source ~/.vimrcKey Vim features demonstrated include file and function lists, pane navigation with CTRL+W, and jumping to definitions using ctags:
ctags -R *
# or for specific languages
ctags --languages=c,c++,java -R3.3 Disabling mouse support in Vim
vim ~/.vimrc
" set mouse=a # comment out this line4. Custom Shell Commands
4.1 Implementing the cl command
Add an alias to ~/.bashrc as shown above.
4.2 Creating a more complex env_switch command
Place the following script in /home/radia/cmd/env_switch.sh and make it executable:
#!/bin/bash
function env_switch(){
if [ "$1" = "A" ]; then
echo "A1,A2,A3"
if [ "$2" = "start" ]; then
echo "will be opened"
elif [ "$2" = "stop" ]; then
echo "will be closed"
fi
elif [ "$1" = "B" ]; then
echo "B1,B2,B3"
if [ "$2" = "start" ]; then
echo "will be opened"
elif [ "$2" = "stop" ]; then
echo "will be closed"
fi
fi
}Make it executable and source it from ~/.bashrc:
chmod +x env_switch.sh
echo 'source /home/radia/cmd/env_switch.sh' >> ~/.bashrc
source ~/.bashrc4.3 Revisiting the bd command
The bd command is a small script (~50 lines) that can be customized further to automate repetitive tasks.
5. Conclusion
If these tips improve your workflow, the author hopes you find them useful. Thank you for reading!
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.
