🛠️ Command Line Tips for Boosting Efficiency

Ever found yourself needing to search through your command history? Here are some quick tricks to make your terminal life easier:

🔍 Search History

You can instantly rerun your last command by typing !!. Want to search for a specific command you ran…


This content originally appeared on DEV Community and was authored by Yassine Sallami

Command Line Tips for Boosting Efficiency

Ever found yourself needing to search through your command history? Here are some quick tricks to make your terminal life easier:

🔍 Search History

You can instantly rerun your last command by typing !!. Want to search for a specific command you ran? Pair history with grep:

$ history | grep conda
3 conda activate dnakey
5 history | grep conda

Need only your last few commands? Try using tail:

$ history | tail -n 3
4 history
5 history | grep conda
6 history | tail -n 3

đź’ˇ Quick Command Fix
Made a typo in your last command? Use ^oldtext^newtext^ to replace part of it without retyping everything. For example:

$ ^conda^pip^

This reruns the previous command, but with conda replaced by pip.

🧹 Cleaning Up History
Need to delete a specific command from your history? Just specify the line number:

$ history -d <line number>

Or clear your entire history file with history -c.

These shortcuts make navigating your command history faster and more efficient.


This content originally appeared on DEV Community and was authored by Yassine Sallami


Print Share Comment Cite Upload Translate Updates
APA

Yassine Sallami | Sciencx (2024-10-26T21:41:00+00:00) 🛠️ Command Line Tips for Boosting Efficiency. Retrieved from https://www.scien.cx/2024/10/26/%f0%9f%9b%a0%ef%b8%8f-command-line-tips-for-boosting-efficiency/

MLA
" » 🛠️ Command Line Tips for Boosting Efficiency." Yassine Sallami | Sciencx - Saturday October 26, 2024, https://www.scien.cx/2024/10/26/%f0%9f%9b%a0%ef%b8%8f-command-line-tips-for-boosting-efficiency/
HARVARD
Yassine Sallami | Sciencx Saturday October 26, 2024 » 🛠️ Command Line Tips for Boosting Efficiency., viewed ,<https://www.scien.cx/2024/10/26/%f0%9f%9b%a0%ef%b8%8f-command-line-tips-for-boosting-efficiency/>
VANCOUVER
Yassine Sallami | Sciencx - » 🛠️ Command Line Tips for Boosting Efficiency. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/10/26/%f0%9f%9b%a0%ef%b8%8f-command-line-tips-for-boosting-efficiency/
CHICAGO
" » 🛠️ Command Line Tips for Boosting Efficiency." Yassine Sallami | Sciencx - Accessed . https://www.scien.cx/2024/10/26/%f0%9f%9b%a0%ef%b8%8f-command-line-tips-for-boosting-efficiency/
IEEE
" » 🛠️ Command Line Tips for Boosting Efficiency." Yassine Sallami | Sciencx [Online]. Available: https://www.scien.cx/2024/10/26/%f0%9f%9b%a0%ef%b8%8f-command-line-tips-for-boosting-efficiency/. [Accessed: ]
rf:citation
» 🛠️ Command Line Tips for Boosting Efficiency | Yassine Sallami | Sciencx | https://www.scien.cx/2024/10/26/%f0%9f%9b%a0%ef%b8%8f-command-line-tips-for-boosting-efficiency/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.