Question

What are your favorite command line tips or tricks?

In the same vein as my previous question about bash aliases, what are your favorite command line tricks? What command has saved you the most time? What bash features did you never realize existed and now use daily and can’t live without?

Of course, there are the classics:

  • !! - Re-runs the last command you entered
  • sudo !! - Re-runs the last command you entered as a super user

What are yours? (No cheating.)

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

screen is one of my favorites. You can do so many things with it. It’s really handy when you want something to keep running after you disconnect from SSH. To disconnect a running screen press ctrl + a, ctrl + d. To see your screens screen -list. To restore one screen -r [somescreenname]

Ctrl+r i.e. reverse search is my favorite.

  • rsync for moving stuff
  • wget is great (especially with the -c (continue) flag)
  • gnu parallel for running batch jobs in…parallel
  • flock for making sure your cron job is only running one instance at any given time
  • the $() for getting the output from a command that was mentioned earlier is great, and you can also
  • I’m not sure where exactly it comes from, I think it ships with perl in deb-based distros, but the rename command is great for bulk-renaming jobs