Linux Format - UK (2020-03)

(Antfer) #1
http://www.techradar.com/pro/linux March 2020 LXF260 73

Control config files TUTORIALS


Firefox
File Function

pref/apturl.js

Sets preferences for how to handle
apt requests
syspref.jsHandles system preferences

Your private files are in ~/.mozilla/firefox/. This is
where your profile is stored. Under the same directory,
you have Crash Reports, your profile and Pending Pings’
That last one stores the last thing Firefox used before
crashing. For space issues, you can look through your
profile. In it, there’s data stored from websites and add-
ons. The safest way to remove this is to use the browser
itself. The reason is that the data is also indexed, so you
may end up with mismatches. A normal profile can be a
few hundred megabytes and should not be shared –
they show your browsing habits.

Firefox private files
File / Directory Function
browser-
extension-data

Keeps data that you collect when
using extensions
crashesStores and prepares crash data
extensions Contains^ the^ extensions^
themselves (*.xpi)
minidumps Crash report data
storage Stores data from websites, cookies
and more

To check which files you need, compare them to
what the documentation says about the files for that
particular application. If you so choose, you can install
Snap instead of your regular package manager. This is a
great option if you want to use it very little or just want
to keep the configuration out of your main machine.
Private settings are set by Snap installed under the
~/snap/ directory, but be careful. Some applications
look for personal settings under your home directory.
You can use this to run a new version with your own
settings or use the new version settings. If you are
developing, you end up with a lot of information to
support your development environments. This goes for
all development, but the most common are Python and
JavaScript. You can put these files wherever you like. If
you don’t take care though, they will end up in your
home directory. For you to stay in control, make sure
you know where they go.
The systems that place these environments vary. For
JavaScript, npm and yarn will be common. The
collections are stored under the node_modules
directory in your project, so make sure you have space
for one of those per project, or set a dedicated space for
a common environment. For Python it works the same
as with other names for the directories. Those names
depend on the system you use for creating them.

Gits in control
Once you start maintaining your settings, you want to
start using version control for your files. To do this, one

solution is git. There are others, but this one tends to
dominate nowadays.
You don’t want a git tree in your home directory so
you need to copy them back and forth or use a bare git
repository. A bare repository doesn’t contain the files
you want to keep under control, instead you need to add
them with special parameters. First, create a directory
for the repository:
$ mkdir ~/dotfiles
Next, initialise the bare repository:
$ git init --bare $HOME/dotfiles
In the directory, you have only the files that control the
repository. To update the repository, you need to state
two parameters; --git-dir and --work-tree. To make it
easy to handle this situation, create an alias:
$ alias config=’/usr/bin/git --git-dir=$HOME/dotfiles
--work-tree=$HOME’
You can use the alias to handle this particular repository
easily enough. Adding a config file, your vim file is a
good place to start:
$ config add ~/.vim/
$ config add ~/.vimrc
Commit the changes to your local repository:
$ config commit
Create a repository on GitHub using the website, and
then set it as the remote:
$ config remote add cfg https://github.
com/<yourusername>/config
Now you need to pull down your README and then
push it to GitHub:
$ config pull cfg
$ config push cfg -f
You now have the parts of the home directory on
GitHub. Repeat the add command with each package
you want to back up. When you have the data on the
service, you can pull it down for your next system.
Once you have mastered your configuration files, you
will be proud to show them around. You can run your
entire computer the way you installed it and never
consider how you can make things better. The truth is
that you can make many things faster and easier when
you put in a little work to tweak your environment.
Space on the disk is one minor detail that you want to
keep under control. The rest are looks and binding
applications together for a workflow that suites you.

CONFIGURE US TO ARRIVE BY... Subscribing now at http://bit.ly/LinuxFormat


It is always safer to erase the bin with your file manager. Other tools are available, like the
autotrash program mentioned in the boxout.

With every
dotfile
collection, you
are bound to
need new fonts.
GitHub is your
saviour again.
Nerd-fonts is a
great collection
of fonts, the
problem is how
addictive it is to
keep looking for
fonts. (https://
github.com/
ryanoasis/nerd-
fonts#patched-
fonts).

7770March 2 h0rIt’shI’imeol March 2020 LXF260 73


Control config files TUTORIALS


Firefox
File Function

pref/apturl.js

Setspreferencesforhowtohandle
aptrequests
syspref.jsHandlessystempreferences

Your private files are in ~/.mozilla/firefox/. This is
where your profile is stored. Under the same directory,
you have Crash Reports, your profile and Pending Pings’
That last one stores the last thing Firefox used before
crashing. For space issues, you can look through your
profile. In it, there’s data stored from websites and add-
ons. The safest way to remove this is to use the browser
itself. The reason is that the data is also indexed, so you
may end up with mismatches. A normal profile can be a
few hundred megabytes and should not be shared –
they show your browsing habits.


Firefox private files
File / Directory Function
browser-
extension-data

Keepsdatathatyoucollectwhen
usingextensions
crashesStoresandpreparescrashdata
extensions Containstheextensions
themselves(*.xpi)
minidumps Crashreportdata
storage Storesdatafromwebsites,cookies
andmore

To check which files you need, compare them to
what the documentation says about the files for that
particular application. If you so choose, you can install
Snap instead of your regular package manager. This is a
great option if you want to use it very little or just want
to keep the configuration out of your main machine.
Private settings are set by Snap installed under the
~/snap/ directory, but be careful. Some applications
look for personal settings under your home directory.
You can use this to run a new version with your own
settings or use the new version settings. If you are
developing, you end up with a lot of information to
support your development environments. This goes for
all development, but the most common are Python and
JavaScript. You can put these files wherever you like. If
you don’t take care though, they will end up in your
home directory. For you to stay in control, make sure
you know where they go.
The systems that place these environments vary. For
JavaScript, npm and yarn will be common. The
collections are stored under the node_modules
directory in your project, so make sure you have space
for one of those per project, or set a dedicated space for
a common environment. For Python it works the same
as with other names for the directories. Those names
depend on the system you use for creating them.


Gits in control
Once you start maintaining your settings, you want to
start using version control for your files. To do this, one


solution is git. There are others, but this one tends to
dominate nowadays.
You don’t want a git tree in your home directory so
you need to copy them back and forth or use a bare git
repository. A bare repository doesn’t contain the files
you want to keep under control, instead you need to add
them with special parameters. First, create a directory
for the repository:
$ mkdir ~/dotfiles
Next, initialise the bare repository:
$ git init --bare $HOME/dotfiles
In the directory, you have only the files that control the
repository. To update the repository, you need to state
two parameters; --git-dir and --work-tree. To make it
easy to handle this situation, create an alias:
$ alias config=’/usr/bin/git --git-dir=$HOME/dotfiles
--work-tree=$HOME’
You can use the alias to handle this particular repository
easily enough. Adding a config file, your vim file is a
good place to start:
$ config add ~/.vim/
$ config add ~/.vimrc
Commit the changes to your local repository:
$ config commit
Create a repository on GitHub using the website, and
then set it as the remote:
$ config remote add cfg https://github.
com/<yourusername>/config
Now you need to pull down your README and then
push it to GitHub:
$ config pull cfg
$ config push cfg -f
You now have the parts of the home directory on
GitHub. Repeat the add command with each package
you want to back up. When you have the data on the
service, you can pull it down for your next system.
Once you have mastered your configuration files, you
will be proud to show them around. You can run your
entire computer the way you installed it and never
consider how you can make things better. The truth is
that you can make many things faster and easier when
you put in a little work to tweak your environment.
Space on the disk is one minor detail that you want to
keep under control. The rest are looks and binding
applications together for a workflow that suites you.

CONFIGURE US TO ARRIVE BY... Subscribing now at http://bit.ly/LinuxFormat


It is always safer to erase the bin with your file manager. Other tools are available, like the
autotrash program mentioned in the boxout.

Withevery
dotfile
collection,you
areboundto
neednewfonts.
GitHubisyour
saviouragain.
Nerd-fontsisa
greatcollection
offonts,the
problemishow
addictiveit isto
keeplookingfor
fonts.(https://
github.com/
ryanoasis/nerd-
fonts#patched-
fonts).
Free download pdf