Skip to content

Instantly share code, notes, and snippets.

@Trivoz
Created December 7, 2023 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Trivoz/a06e68df87e522f5559fafbe3205e1bc to your computer and use it in GitHub Desktop.
Save Trivoz/a06e68df87e522f5559fafbe3205e1bc to your computer and use it in GitHub Desktop.
my linux workflow

Doing Linux


Table of Contents

  • Dots! (aka dotfiles)
    • GNU STOW
    • stowing your bash
  • VIM

I thought that I'd write down a little something about how I do Linux. One does not simply 'do' Linux, but that's my way of describing my workflow, since it's sort of centered around Linux.

Quirky jargon talk aside, this is a short article/gist/whatever about me and what I do every day, what I think others might benefit from, and some neat stuff like that. So let's start :)

DOTS! (aka. dotfiles)

I like dotfiles. Okay, that's an understatement. I love dotfiles. I have all sorts of ways in the past that I've gone about customizing my dots, and currently I use GNU stow. Let's talk about it.

GNU Stow

First, with an example, since thats the way that I like to demonstrate stuff: Okay, so let's start with a common thing that everyone has in linux: a .bashrc (maybe you have a .zshrc, or some other config if you use a different shell but i'll keep it general)

So let's say you have a .bashrc file at $HOME. 1 That's great. It looks like this: (hypothetically, of course)

# A few aliases
alias la='ls -l -A --color=auto'
alias ts='tmux new -s'
alias co='git checkout'

# a few exports
export PATH="$HOME/.local/bin/python/python_apps:$PATH"
export PATH="$HOME/.local/share/ruby_stuff_or_something:$PATH"
export PATH="$HOME/.local/another_path_here:$PATH"

Your amazing bashrc, since you keep stuff minimal. Nice.

Stowing your bash

what a weird title...

Anyway so using Stow, you can basically put your bashrc anywhere now. If you want to create a folder to store all of your dotfiles, go for it.

So if you want your $HOME to be as clean as can be, with 0% clutter, read on!

Let's store our new bashrc somewhere where we can store all our dots... somewhere like...


$HOME/Personal/Dotfiles/.bashrc


Now, currently our .bashrc doesn't exist. (according to our computer) since it's not in $HOME/.bashrc Let's change that by creating a symbolic link (aka a symlink) from the location of our personal dotfile folder and creating a link in $HOME. Now this is starting to get pretty awesome.

Q: Why is this awesome?
A: You can change your dots in from anywhere, and your computer doesn't care! It thinks you're changing them in $HOME! What an idiot!

aka; no clutter :P

  • let's install stow real quick:
    sudo pacman -S stow

  • and now let's stow our dotfiles.
    cd $HOME/Personal

  • And so we can link every single file in our Dotfiles folder into HOME with one command:
    stow Dotfiles

Simple. Easy as that.

VI

You know how the keyboard has shortcuts like ctrl+c for copy ctrl p for paste ctrl + z for undo and all that... Well image if every single key on the keyboard was a shortcut to some sort of action/motion. Introducing: Vi

the Vi text editor first hit open source in in the late 70s. This was a time when everything was done in terminals. No fancy graphics, popup windows or anything like that. Simple black and white text on a low res screen, just as our lord intended. Since there wasn't a mouse at that time, VI made sure that everything could be done without a mouse. Everything was done from the keyboard. let me give you a rundown.

Look at the home row of your keyboard, specifically where the right hand rests.
You'll see the keys: h j k l
It makes sense that if you aren't using a mouse, you should move with these keys, since you don't need to adjust your fingers to press them, because they are on the home row already.

Okay, so now we have movement! But what about editing text?
Well VI is a modal editor. This means that there are different modes depending on what you want to do.

Here's the default mode: NORMAL mode.

Normal mode is the mode that you are in (or should be in) most of the time. You can't insert text in normal mode, because you can only do that in INSERT mode. In NORMAL mode you can move around freely using the text keys h j k l like i said before. But you can also move around pages like a book. To move forward one 'page' do ctrl+f. to move back one page do ctrl+b.

If you want to move up you press ctrl+u for up and ctrl+d for down.

If you want to center everything on the cursor do zz in NORMAL mode.

And then for insert mode press i to go into insert and escape to get out of it.

To quit go into COMMAND mode by pressing shift+; and type q or quit but if you were to force quit, you would add ! to the end of q/quit to it would be q! or quit! becuase ! means overwrite changes/file permissions.

Footnotes

  1. Also, side note - I may refer to the home directory as $HOME, ~, or some other sort of way, but it's all the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment