LowEndBox - Cheap VPS, Hosting and Dedicated Server Deals

Top Ten Things That Should Be In Your Dot Files

Top Ten Things That Should Be In Your Dot Files“Dot files” are Unix configuration files that live in your home directory.  They’re often used to store user-specific choices and preferences.  For example:

  • .bash_profile is executed whenever you login via ssh (or any other method).  It is typically used to control your Unix shell experience.
  • .vimrc contains customizations for the Vim editor, while .emacs contains cusotmizations for the Emacs editor
  • .ssh is a directory that contains all of your ssh-related configurations
  • .vnc contains all of your VNC remote desktop configurations

Etc.  In this tutorial we’ll talk about some easy, common customizations that you can use to make Linux (or *BSD) more pleasant.

The ll alias

In .bash_profile:

alias ll='ls -al'

If you work in the shell a lot, this one alias will save you millions of keystrokes.  Every time you type “ll” instead of “ls -al” you will save 4 strokes.  It’s an extremely common alias.

vi Mode in Bash

In .bash_profile:

set -o vi

If you use the One True Editor (vi, or vim), then you’ll be delighted to know you can use it command-line as well. Just hit ESC and you’re in vi command mode and and use vi keys to zip to the start or end of the line, search, back up and replace, etc.  By default, bash starts you in emacs mode with all those pinkie-contorting Control-A, etc. keystrokes.  If you’re a vi user, switch to vi mode.

The EDITOR and VISUAL variables

In .bash_profile:

export EDITOR=/usr/bin/vim

These environment variables control which editor is used in various programs where the program wants to invoke the user’s preferred editor.  EDITOR is used in cases where you’re on a teletype-style connection and don’t have full screen capabilities – these are pretty rare, perhaps nonexistent cases for most people.  VISUAL is used for normal editing.  Of course, you can also set this to use nano, emacs, etc.

The PS1 Variable

This controls your prompt.  There are many, many options for this.  For example:

export PS1="\u@\h [\!]$ "

will give you something like this:

raindog308@someserver [502]$ 

That 502 is the current command number, so I can look back and rerun the command with !502.  Or you could do something like this:

export PS1="[\A] \w: "

This will give a prompt like this:

[20:10] /tmp: 

This tells me it’s 20:10 (8:10pm) and I’m in the /tmp directory.

Again, consult the manual for tons of different ways to customize your prompt.

ssh Aliases

If you travel around a lot from that shell (you often ssh to other boxes), make life easy for yourself by setting up passwordless SSH and creating aliases in .bash_profile like this:

alias someserver="/usr/bin/ssh -i /home/raindog308/.ssh/my-passwordless-key -p 2222 raindog308@somewhere.lowend.party"

Then I need only type “someserver” at the prompt and I’m taken there.

vimrc setup

.vimrc is the dot file that controls how your Vim editor works.  Some systems come with a pretty poor vimrc.  Here’s a basic one to get you going:

In .vimrc:

filetype plugin on
syntax on
set tabstop=2
set number

This configuration:

  • Turns on syntax coloring based on the file type
  • Changes the default tabstop to 2, so you don’t indent as much (season to taste)
  • Turns on line numbering to make addressed commands easier (e.g., “:14,16d” would delete lines 14 through 16, and it’s easier to see which lines those are with line numbers)

See the vim documentation for more options.  Many, many more options.

Get Rid of the Bowling Lane Rails

Some systems like to do things like this in .bashrc to prevent you from hurting yourself:

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

These result in a various confirmation prompts.  For example:

# rm /tmp/junkfile
rm: remove regular empty file '/tmp/junkfile'? 

You can get rid of these prompts in one of two ways:

  • Typing rm -f, cp -f, etc. (The -f means “force aka don’t ask me”)
  • Removing these aliases from either your .bash_profile or .bashrc

Have a Fortune Cookie!

You can install a package on your system called fortune (for fortune cookie) which will give you random quote or prediction.  For example, on Debian:

apt-get install fortune

And then:

You will pioneer the first Martian colony.
# /usr/games/fortune
You'll feel much better once you've given up hope.
# /usr/games/fortune
Lord, what fools these mortals be!
  -- William Shakespeare, "A Midsummer-Night's Dream"
# /usr/games/fortune
  It is by the fortune of God that, in this country, we have three benefits:
  freedom of speech, freedom of thought, and the wisdom never to use either.
    -- Mark Twain

You get the idea.  There are many different databases of fortunes, and lots of options to choose which database you pull from, if you want offensive fortunes, etc.  “man fortune” for full details.



in your .bash_profile and get a fortune cookie every time you login!

Get Internet News (From a Moose)

Check out this command:

host -t txt istheinternetonfire.com | cut -f 2 -d '"' | /usr/games/cowsay -f moose
/ #cdpwn: Multiple RCE and DoS            \
| vulnerabilities in Cisco's proprietary  |
| L2 protocol, CDP. More like Complete    |
| Disaster Protocol, amiright?            |
| https://www.armis.com/cdpwn/            |
| https://go.armis.com/hubfs/White-papers |
\ /Armis-CDPwn-WP.pdf                     /
   \   \_\_    _/_/
    \      \__/
           (__)\       )\/\
               ||----w |
               ||     ||

What we’re doing is using the “host” command to query the DNS text records for “istheinternetonfire.com“, which reports major vulnerabilities (CVEs).  That site updates the info on both their web site and in DNS text records.  We query it and then pass it to cowsay, which prints out whatever you give it as the word balloon of an ASCII art animal (in this case, a moose).  You probably need to install the cowsay program, but that’s as simple as

apt-get install cowsay

Put the above command in your .bash_profile (with or without the cowsay command) and be greeted with Internet news whenever you login.

Of course, you could also use fortune:

# /usr/games/fortune | /usr/games/cowsay -b
/ You're being followed. Cut out the \
\ hanky-panky for a few days.        /
        \   ^__^
         \  (==)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Fix Your Typos

If you’re prone to always mistyping a command, make life easy.  For example, if you’re prone to typing “youtubed-l” when you meant “youtube-dl” then this alias in your .bash_profile will let you use either:

alias youtubed-l="youtube-dl"

Salt to taste.




  1. fedor:

    nice) btw, openssh client has it’s own pretty readable and tunable config w/ aliases:

    Host foo
            Hostname foo.com
            User root
    Host bar
            Port 222
            ProxyCommand connect-proxy -S %h %p
    Host *
            User root
    October 13, 2020 @ 9:18 am | Reply
  2. LEB Fan:

    Please fix your wordpress theme css to show

     command scroll bars. FROM overflow: hidden; TO overflow: auto;
    #content pre {
      overflow: auto;
    October 13, 2020 @ 9:52 am | Reply
    • What will this change?

      October 13, 2020 @ 11:40 pm | Reply
      • LEB Fan:

        Horizontal scroll bar for code blocks if it exceeds. Currently, you cannot scroll when it overflows. For example, see the code block at “ssh Aliases” in this post. You cannot scroll from left to right to see what text it contains.

        October 16, 2020 @ 1:53 pm | Reply

Leave a Reply

Some notes on commenting on LowEndBox:

  • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
  • Akismet is used for spam detection. Some comments may be held temporarily for manual approval.
  • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

Your email address will not be published. Required fields are marked *