I recently had my first end-semester exams. I won’t say that I left all the tech stuff in between but yes, it was slowed down. Getting back to it, what I was introduced to was how actually we use dotfiles. Follow along and see how I ended up slightly customizing the bash I use!
I also met CuriousLearner along with cRAN-cg in this time! They are two amazing people if you haven’t met them yet. CuriousLearner suggested I should look into how dotfiles work. He also provided us with his dotfiles and currently, I am working on only one of his file, converting his mac setup to a Fedora setup.
What Are Dotfiles
It is a general name for any file that begins with a dot.
file1 # This is a normal filename .file1 # Now this is a dotfile
What makes them different is that in Linux( And Unix) filenames that begin with a dot are treated as a hidden file. It is possible to do that to folders also. Which means that a normal ls command wouldn’t list them.
To list all the files you have you need to use the
-a flag with ls command. And that
a stands for all.
ls -a # To list all files including the dotfiles ls -a | grep '^\.' # To list all dotfiles
What Is Its Use?
So what is the use to hide a file. What is the use of such “dotfiles”?
Think that you have a lot of software installed on your operating system. And special configuration for each of them is stored in a file. Then your home directory will consist of your own files + the files you didn’t create. Not only it’d look cluttered but also create significant confusion if similar names arise.
Hence to deal with such cases a dotfile is created. Its main use is as a configuration file. Like if you read my SSH post, it had created a directory
.ssh in your home folder. Which then was used to store all the keys you generated and also the authorized_keys. Likewise, vim has a file .vimrc and bash has one too named .bashrc
Since they are mostly used to store configuration, all files that help set up and configure an environment are also called dotfiles.
The one I’ve been working on
As you can see it does not have a dot but is used to setup a new Mac machine to include all the packages that he used to work with.
The interesting part came when I tried to see what all packages were there.
I’ll be noting the ones I understood here:
- zsh: It’s Z Shell. Like bash, it’s also a shell. (We’ll go in minor details later on)
- curl: Though it’s a pre-existing command in most Linux distros, I came to know about it while seeing it used here. It helps transfer the data here and there using terminal. I even ended up using it for making my work easier later on. 😛
- autojump: According to your recent change directories. It’ll help you switch to them quickly using shorter commands.
- fortune: It prints random and interesting statements
- sshrc: Similar to ssh command, it logs you into a remote pc. But also sources the .sshrc file’s content so that you can save frequently used commands and aliases in there and use them on the remote pc too!
- editorconfig: Helps you keep consistency in coding style
- keybase: It’s an app like slack but with encryption
- flux: It is an app written in python to adjust screen color according to the time in your timezone.
- numi: Not for Linux, only mac. It’s a beautiful looking calculator.
- postgres: It is a Database management system with more functionality like it supports some object behaviors for example inheritance.
- elasticsearch: It is used to search and analyze large amounts of data.
- tmux: Used to manage lots of simultaneous terminal windows.
- lastpass: A password manager
- howdoi: I liked this one. It’s a command line how to!
And Not only that I tried zsh so that I’d understand what did his dotfile do! I tried installing powerline(Discussed later) fonts in BASH but they didn’t work there. So I tried them in zsh and they worked there. Also, zsh has a lot of themes and oh-my-zsh is amazingly popular!
You can create your theme or use there’s. It’s simple to do using:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
This install script would do the basic setup for you and will also put all themes in ~/.oh-my-zsh/themes folder. You can then go to the zsh config file, i.e
.zshrc and set
ZSH_THEME=agnoster to set it to agnoster or set it to any other theme of your wish. To use the powerlevel9k theme you need to download it:
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
Now set the
ZSH_THEME variable to
And now you’ll have a pretty good looking zsh shell.
Mine looks like:
But I still prefer bash. It’s what I’ve been using since I started using Linux. You can customize that too. I used simple powerline setup to make mine look good and sober.
I referred to this. It’s pretty simple and straightforward.
But when you will be trying zsh, you might need help setting up powerline-fonts. For that, you can refer to this webpage.
After doing the basic powerline setup, I was able to make my bash look like this:
And I like it. Hopefully, I won’t be changing it anytime soon. And will be setting up my own repo of dotfiles in coming days. You might catch me doing that on http://www.thegeekyway.com