Originally posted onlistnux.com
You are coding in Python. Your screen is filled up with terminals of various sizes and lenghts, and you have a deadline. It is 2.00 am, winter, the room is chilly, and there is a storm outside.
You have a big dictionary, and you want to sort it by a numeric value. How to do this? You turn your head around the screen, to spot your favourite browser, and to ask your friends, Google, or StackOverflow. You know the browser is there, it has always been there for you. But all the terminals all over the screen cover it completely. You curse your decision to use a window manager without taskbar and frantically start moving and minimising terminals.
Well, you are in luck. You might not need to.
Ridiculously good command line tools
1.cheat.sh - the only cheat sheet you need
A cheatsheet that let's you access not only actual cheatsheets and simple overviews of various commands and programming languages, but it even queries Stack Overflow for answers? And automatically selects the most upvoted thread that matches your search term? Yes, that'scheat.sh.
To find out what Stack Overflow has to say about our previous question, without leaving the terminal, is as simple as:
curl cheat.sh/python/sort+dictionary+by+value|more# ORcurl cht.sh/python/sort+dictionary+by+value|more
Alternatively,you can install the command line client,cht.sh
, so that you don't even have to typecurl
, or add+
between the terms:
cht.sh pythonsortdictionary by value
Notice the link at the end (so/q/613183
)? It stands forhttps://stackoverflow.com/q/613183 and it is the most upvoted question in Stack Overflow that contains the queried terms. Say, though, the most upvoted question does not answer your specific issue (though this particular answer is excellent)? Simply extend a/1
or/2
or any number at the end of your query. For instance:
curl cht.sh/python/sort+dictionary+by+value/1#orcht.sh pythonsortdictionary by value/1
will return the top answer tothis Stack Overflow question
2.Rebound - Command-line tool that instantly fetches Stack Overflow results
So, with the help ofcht.sh
, you figured out the answer of your question and finished a part of your project. So you run it, and, whoa... compile error. You can still type the error forcht.sh
to fetch an answered question from StackOverflow, but, why waste time typing a long error, when you can useRebound?
Rebound is a fantastic Python tool, that allows you to simply execute the file and directly pull the error message and find related Stack Overflow questions. It works with Python, Ruby, Java, Goland and Node.js and it is as simple as:
# instead of typing:python app.py# you simply type:rebound app.py
And here is what happens:
Once you press enter, you get a list of related Stack Overflow threads:
Fantastic? Absolutely!
3.mycli - A terminal client for MySQL
mycli.net, at first glance, might not seem as sexy as the previous tools, but it is insanely handy when you are working with MySQL databases.
It packs auto-completion for SQL keywords and tables, views or columns, logs, colourful tabular data, multiline queries and more.
But what's more, it permits you to save complex (or simple) queries as aliases for future use. It allows parameter substitution for your saved queries, so you can reuse them whenever applicable.
For example, I have saved a query, which generates aDROP
statement for tables starting with a certain string:
\fscleardbSELECTCONCAT('DROP TABLE ',GROUP_CONCAT(table_name),';')ASstatementFROMinformation_schema.tablesWHEREtable_schema='$1'ANDtable_nameLIKE'$2__%';
with$1
being my database name and$2
the string I want my query to match on the table name. Simply invoking the alias with:
\f cleardb"my_database""my_string_"
will return the drop statement I need. You really don't realise how much you are missing a tool like this, before you actually try it.
Also see thepgcli project for Postgres
4.Bat - a cat clone with winds
Bat is a Rust tool that aims to be the better, prettier and more handy replacement of cat(1). It features syntax highlithing, line numbering, theming, pagers, and it communicates with Git to display file modifications.
Bat can completely replacecat
and it can be used in pipes (bat .bash_profile |grep PATH
), or withfind
:find -type f -name README.md -exec bat {} +
5.Fiche - termbin.com
You were still coding that Python script, remember? And decided to share a file with your friend.
Now, you can login to GitHub and post a gist, or to GitLab and post a snippet, or to Pastebin. But, yeah, your browser is hidden below a few stacks of terminals. So, what can you do?
This:
cattest_howdoi.py | nc termbin.com 9999# or 'bat test_howdoi.py...'
The terminal returns a simple URL:https://termbin.com/wf6u in the above case. You text this URL to your friend, and, behold, you just shared your file, without ever leaving your terminal. (In case you are wondering, I shared a file fromhowdoi, a fantastic command-line tool, which is not in the current list, as it has a bit similar function with the first two tools listed).
Termbin.com is a public pastebin server that works with the commandline pastebin toolfiche. It is very quick, keeps pastebins for a month and even has syntax highlighting (try the above link withl.termbin
instead oftermbin
:l.termbin.com/wf6u).
What's more, you can installfiche and self-host your own pastebin server.
6.GRV - terminal interface for git
Sometimes you don't know anymore what's going on on your local git repo. You remember that your last few commits were "Fix #1999", "Prev fix broke things, revert to #1998", "Fix #2000", "revert Fix #2000", "final fix", "%#&@ this I go to sleep", but you need to see what files you changed on each commit, the diffs, the commit messages.
And of coursegit allows you to do all of this. And of course, there is an even easier way, to see all your commits, diffs and refs on a nice, easy to browse table.
"Yes,*I know* ", you say, "it is called*GitHub*. I need to dig out that browser".
Or you can simply useGRV. It presents all the above info on a nice table right on your terminal. It has tabs and splits and custom views, queries, and your terminal refreshes automatically whenever there is a change on the filesystem.
GRV is a tool you don't realise how much you need it, until you actually use it. It makes the presentation of your git repo so easy to grasp and browse, that it is a must-have tool if you work with Git a lot (and you should work with Gitall the time, if you are coding).
7.GoAccess - real-time web log analyzer
One of these things is not like the others. The last tool on today's list is not going to help you in your coding adventures. But, if you have a website, it will analyse the logs of your web server and allow you to view them directly on your terminal.
This is awesome, cause theaccess.log
logs on most servers are hard to read and even harder to analyse quickly.GoAccess will allow you to have visitor statistics for your website without tracking your visitors,compromising their privacy and sharing their browser habits with big Internet monopolies.
It's meant to satisfy a simple curiosity about how many people visit your site and what pages they view. It's not a tool to replace Google Analytics, or Piwiq/Matomo, or Statcounter. It is meant to simply present nicely the logs your web server already keeps.
[Bonus]wttr.in - the right way to check the weather
So, is this storm still going outside? You can't hear any rain dropping on your windows, but you can't be sure without leaving that terminal (or that chair). Why don't you simplycurl wttr.in
orcurl wttr.in/YOUR-LOCATION
?
Nope, not a single cloud. Nice!
Top comments(0)
For further actions, you may consider blocking this person and/orreporting abuse