How do you write great code?
If you want to create something awesome, youll have to eliminate the time dumps that slow you down.
Create aliases
Every shell comes with a file called~/.bashrcor~/.bash_profile.

Which one youll use depends on your system.
This post explains it in detail.
Now think about commands that you use a lot.
Typing them each time is arduous, and you could mess things up if youre prone to making typos.
That is what aliases are there for: They replace your original command by a shortcut.
For example, I have a Dropbox folder that I need to access quite often.
If youve ever accidentally overwritten something important, you know what Im talking about.
If youre using a lot of aliases, it might make sense to create a separate file.
Just pack all your aliases into a new file called~/.bash_aliases.
Now, you should probably tell your original configuration file where the aliases live.
~/.bash_aliasesfi
And youre done!
If you open a new window, it will source the file automatically.
So it makes sense to tailor it to your preferences.
Im a minimalist, so I only include the current directory in my prompt.
Other popular options are:
you’re able to also print your prompt in colors.
Of course theres the tab completion start typing a command, then hit tab to auto-complete it.
But what if want to access your past commands?
There are a few options:
4.
Use your environment efficiently
Youve already encountered a few environment variables PS1,HISTSIZEandHISTFILESIZE.
In general, these are variables written in CAPITAL LETTERS that define important properties of the system.
you’re able to get into the complete list of them with the set command.
Another example (of many) isSHELLOPTS.
It lists all the programs that are set to on upon startup of your terminal session.
A full documentation of the preset variables can be found in the GNU documentation.
Profit from shell optionsYou can customize your shell in a number of ways with shell options.
In the displayed list, youll also see whether an option is toggled on or off.
you’ve got the option to change the default setting by adding a line in your configuration file.
The second saves you from typingcdevery time you want to change your directory.
Then from your home directory, throw in:find .
-name foo.txt
Here, the .
stands for the current working directory, and you specify the file name with the option -name.
you’ve got the option to also use wildcards.
For example, this command will return all files in txt format:find .
-name *.txt
7.
Search for files by content
Say you want to search for all occurrences ofbarin foo.txt.
Just hitman grepin your terminal.
Thats where piping with the symbol|comes in handy.
Say for example that there are a thousand files in the directory dirfoo that contain bar.
You might want to sift through the output and cherry-pick the files that interest you.
This will leave your command line interface uncluttered.
you’re able to also usegrepin the inverse way.
Say you want to run a programfooprogwhich produces a lot of output.
But youre only interested in the part that containsbar.
This way, you might ensure that you only get meaningful information printed in your terminal.
Move around in text
You thought your terminal was all about keystrokes?