What Are Your Favorite Command Line Hidden Gems?
(Source/Credits: https://dev.to/rpalo/what-are-your-favorite-command-line-hidden-gems-77p)
Let’s see some neat new commands!
title: What Are Your Favorite Command Line Hidden Gems? published: true description: Let’s see some neat new commands! tags: commandline, discuss
I just found out about gpp, which is a neat text preprocessor for quick and low-power templating. Which sparked me to look for other commands that are super cool but might not show up in the beginner tutorials.
So here it is: what are your favorite commands that might not be as popular? Bonus points if they come pre-packaged on your favorite OS. Big bonus if you don’t have to install them with a language-specific package manager like pop, gem, or npm—not because there’s anything wrong with u them. I’m just trying to steer this away from a pile of “just npm install kitchen-sink-robot-suit!”
Comments section
vguarnaccia
•May 1, 2024
curl -vvv
is helpful for learning and experimenting with all things http related.Not exactly a command, but favorite bad habit is running processes in the background with
slow_cmd &
.rpalo Author
•May 1, 2024
The more I learn about curl, the more it blows my mind how powerful it really is.
With regards to backgrounding commands, I know about the ability, but I've never had an instance where I've thought to do it. What kind of commands do you find yourself backgrounding?
wrldwzrd89
•May 1, 2024
My favorite command I often forget about is
tee
- used for simultaneously writing to the terminal AND to a file. It works best as part of a pipeline, which makes it a good fit for any shell supporting them - pretty much all the modern shells do now. I like to use this for verification: Did what my shell script print out match what I expect it to?molly
•May 1, 2024
One of my favorites is an oldie but goodie, the table_print gem.
It allows you to print arrays of data out in nice tables
chanduthedev
•May 1, 2024
file command to know file format. Some times file name may contains wrong extension or doesn't contain extension. In this case file command really helps to know the format of the file. Below is the syntax.
file file_name
And below are some of results for file command.
"ASCII text" - normal text file
"ASCII text, with very long lines" - CSV file with large lines
"Zip archive data, at least v4.5 to extract" - ZIP file
io_io_rocks
•May 1, 2024
I am on Linux since 2005 and here's one of the most often used things:
I do
CTRL + R
to get the reverse CLI history, then I just type the first characters from:find . -type f -name ".*.sw*" -exec rm -f {} \;
, find it then hit Enter.It finds all the .swp, swo, etc files left from my vim sessions and deletes them.
Also, big lol @
npm install kitchen-sink-robot-suit
:-))That name surely needs a package!
fcfn
•May 1, 2024
You can also use the specific -delete action with
find
.jbeetz
•May 1, 2024
It's not so much of a command but rather the concept of the | symbol. The pipe symbol is pretty a universal concept.
I use it in Powershell commands and Linux commands.
This Linux command gets a lot of use:
ps -ef | grep <'any string here'>
Or
history | grep <'whatever command I think I just ran'>