Hello Readers!
I'm back and better than ever with another article about developer productivity. I love the Terminal. After all that's where everything comes to an end. Or begins. (Only nerds get that joke.)
Today I'm going to discuss four (yes, just 4) cool *nix tools, utilities that help you get things done faster once you integrate them into your workflow.
- tmux
- tree
- find
- ripgrep
tmux
tmux is a multiplexor. Do you log in to remote servers using ssh clients, like ssh and/or putty? Do you have to spawn multiple of those just to get more done? Does that slow you down? Of course it does.
Well, look no further. Spawn one terminal and invoke the tmux. That's all you need!
Spawn it with: $tmux
Note: tmux may not be available by default. To install it, use your favorite package manager. This screen cast demos how to use tmux.
Tmux, click for demo |
tree
tree provides a nice layout of the directory structure in your terminal. Don't get me wrong: I don't have a dislike for UI. I like visual representations, and sometimes looking up the directory structure is more important. This is where tree comes into play. You don't have to spawn an IDE to see how your directory structure looks. You also don't have to go in and out constantly using cd commands to make sense of the structure. That's a lot of cognitive load.
Invoke it with: $tree
Are you going to run tree on a top level directory? If so, that will be a big tree! Pipe it to less ($ tree | less), and you can navigate up down using j and k. (Yup, Vim commands work here too!) Use gg or G to go to the top or bottom of the document respectively. It's amazing how knowledge of Vim bindings works across *nix tools.
tree, click for demo |
find
I'm sure a lot of you know this, but for those who don't.... Let's say you have to do a quick recursive find. You are in some directory and want to search for a file inside the directory recursively.
Here's the command: $find . -name BUILD
Now let's break it down.
. is the current directory
-name is the parameter to indicate the file name
This will look recursively for a file BUILD inside the current directory. It will not stop at the first instance. Rather it will get you more.
find click for demo |
ripgrep
Ripgrep is grep -R on steroids. Let's say you want to find files which have a certain text within a file. Use ripgrep abbreviated as rg.
Note: This tool may not be available by default. Use your favorite package manager to install it. Click here to read more.
Here's an example of the command: $rg -e "dart"
This will list all the files which include the word "dart." Isn't that awesome?
For even more awesomeness, use Vim with ripgrep. It will search and quickly load the file in the buffer.
ripgrep click for demo |
What are your favorite command lines tools? Please share. I will be happy to learn from you!
Comments
Post a Comment