Advertisement
General Discussion

What is Your Favourite Command Line Trick?

Linux Favourite Command Line Trick
Written by Martins D. Okoi
Advertisement

The command line was the first method to interact with the computer in a friendly manner long before Graphical User Interfaces came along. Till date, many tech-savvy computer users, especially Linux users, prefer working with the command line for many reasons, some of which were discussed in Why Do So Many Linux Users Prefer the Command Line to a GUI?

If you make use of the terminal more often than the typical computer user then odds are that you have one or more nifty ways of getting things done with it. It could be the way you concatenate commands together in scripts, the shortcuts you have thought your terminal app, or the hacks you have discovered online.

A fan favourite is sudo !!

Nifty when you ran a command that requires higher permission but did not include the sudo keyword. Sudo !! runs the last run command with sudo credentials; thereby, freeing you of the need to retype the command.

Advertisement

I stumbled upon entries by users online and some of them went as far as customizing their profile, creating automation scripts, aliases, and shortcuts for complex commands.
aa
For example, one user who uses ‘less -FsXR‘ a lot set it to a two-letter alias and to prevent Less from complaining when he tries to read a directory instead of a file, he went further to add the command in his shell rc-file as:

LESSOPEN='|dir=%s;test -d "$dir" && ls -lah --color "$dir"';export LESSOPEN

Definitely, a smart way to get work done!

  Why Microsoft Won’t Use the Linux Kernel for Windows

I’m positive that you have either learnt or created ways to work faster with the command line. Or at least, you have learnt shorthand methods for completing tasks that you didn’t know when you just started using the CLI. Share your experience with us by penning them in the comments section below.

Advertisement

About the author

Martins D. Okoi

Martins Divine Okoi is a graduate of Computer Science with a passion for Linux and the Open Source community. He works as a Graphic Designer, Web Developer, and programmer.