Mithil Poojary
Posted on June 9, 2020
1. column
I, as a programmer, do not mind those nastily formatted tabular data, like...
Pid Name %CPU
1230 Firefox 15
600 Code 12
809 Terminal 1.2
But when I learnt about column, I was pretty fascinated by how easy it is to make it neat!
column <file_name> -t
Pid Name %CPU
1230 Firefox 15
600 Code 12
809 Terminal 1.2
2. less
How many times did you feel disgusted by the mess you made on your terminal screen? Maybe you printed a huge file or did ps aux. I have been there.
A very neat solution is to use less. The text is displayed upon applying a filter for paging through text one screenful at a time.
You don't have any clutter on your terminal once you exit less.
3. sort
Imagine having a file with ID and Names like this.
16 Siri
20 Cortana
13 Mithil
9 Jarvis
A quick sort on the IDs would be super helpful right?
sort <file_name> -n
9 Jarvis
13 Mithil
16 Siri
20 Cortana
4. tr
I can't really think of a better situation to use this right now, but hey it works.
Say you have to replace the occurence of a character. tr (translate) does this for you.
echo "This is a sentence" | tr " " "\n"
This
is
a
sentence
5. head and tail
Head and tail themselves are pretty solid tools, but together they have their own use case.
Say you want the 11th line in a text file. You can do this by :
head <file_name> -n 11 | tail -n 1
That was all for this post. What are your preferred helpful Unix tools?
Photo by Karl Pawlowicz on Unsplash
Posted on June 9, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.