Below are different things I’ve done to configure a LINUX host.

Make resizing windows easier

On Linux I’ve found a (for me) very easy way to resize windows using Alt+MouseRightDrag anywhere in the window works nicely for me. To get this functionality I used the commands below:

gsettings set org.gnome.desktop.wm.preferences resize-with-right-button true
gsettings set org.gnome.desktop.wm.preferences mouse-button-modifier '<Alt>'

These commands were from a StackOverflow post at: how-to-get-altright-mouse-to-resize-windows-again

Sudo without passwords

How can I setup sudo so I can run it without entering my password every time I use it? NOTE: I know that there is a timeout that lets you run it for a bit without requiring it again, but if I want to disable it entirely how do I do that?

PRO TIP Before changing sudo file, always have a bash shell already opened so that if you screw it up and loose sudo you can fix it!

Before you change your sudoer file make sure you add yourself to the sudo’ers group.

sudo vi /etc/group
sudo:x:27:user1,user2

Add your username to the list, and comma separate if multiple users need to be added.

Next, edit the sudo’ers file using:

sudo visudo
# Then make this change
# %sudo ALL=(ALL:ALL) ALL
%sudo   ALL=(ALL:ALL) NOPASSWD: ALL

Run

sudo -l

To see the sudo configuration you’re user has. For example, I see

sudo -l
Matching Defaults entries for user1 on host2:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin,
    use_pty

User user1 may run the following commands on host2:
    (ALL : ALL) NOPASSWD: ALL

Make the Start-Like toolbar auto-hide

  • Open Settings from the Applications menu.
  • Go to Appearance.
  • Under the Dock section, toggle Auto-hide the Dock to ON.__
  • Optionally, adjust the Intelligent Auto-hide (GNOME tweak tools or extensions may be needed for advanced behavior like hiding only when apps need the space).

This might work

# To show dock only when hovering:
gsettings set org.gnome.shell.extensions.dash-to-dock autohide true

# To hide only when windows overlap the dock:
gsettings set org.gnome.shell.extensions.dash-to-dock intellihide-mode 'ALL_WINDOWS'

Misc Tips when working as root

Have you ever had sudo accidentally get removed because of something you did?
I changed a user’s login name and after that they could not sudo anymore because the new login name wasn’t listed in the sudoers file!

PRO TIP: Before doing anything as root that might prevent you from becoming root again, you should first open up one or two root windows so that if sudo fails, you have another root window to fix the problem.

PRO TIP2: Before adding a user that will have sudo privleges, add that user to the /etc/group file!

PRO TIP3: When changing a local UID to match a corporate UID to work around some error be sure to add the local username to the sudoers file.

Installing Applications

On Ubuntu, use sudo apt install or sudo dpkg -i *.deb to install a locally downloaded debian package. When installing locally, I store apps in $HOME/.apps or for Java in $HOME/.jdks.

Installing Chrome

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb

google-chrome --version
Google Chrome 134.0.6998.165
which google-chrome
/usr/bin/google-chrome

Installing git

I didn’t find a tarball to install it but I think it MUST exist!

sudo apt install git

Installing emacs

sudo apt install emacs

Installing Java

See my other blog. Java Installs. JDKs are stored in $HOME/.jdks

Installing local packages

I use $HOME/.apps for my local install of packages. I’ll unzip the original. For example, groovy-4.0.15 and IntelliJ (idea-IU-232.10227.8) I’ll make symbolic links to the version I typically use:

groovy -> groovy-4.0.15
intellij -> idea-IU-232.10227.8

In my .bashrc, I’ll add groovy/bin to my path:

    pjs_addPathIf $HOME/.apps/groovy/bin
    pjs_addPathIf $HOME/.apps/intellij/bin  

By adding these directories to my UNIX PATH, I can start them from the command line and have them pick up my SSH environment variables so my ssh-agent and desired version of java/groovy/gradle/etc can be used.

Installing IntelliJ

See my downloads. I install under $HOME/.apps and have the default IntelliJ version that I prefer to use as a symlink so

$HOME/.apps/intellij -> idea-IU-243.26053.27

Installing Groovy

#

What package manager do I use to install apps?

Below is a table with popular package managers

Package Manager Supported OS(s)
apt Debian, Ubuntu, Linux Mint, and other Debian-based OSs
dnf Fedora, RHEL (Red Hat Enterprise Linux), CentOS
yum RHEL (Red Hat Enterprise Linux), CentOS (older versions), Oracle Linux
pacman Arch Linux, Manjaro, EndeavourOS
zypper openSUSE, SUSE Linux Enterprise (SLE)
portage Gentoo Linux
emerge Gentoo Linux
rpm RHEL (Red Hat Enterprise Linux), CentOS, Fedora, openSUSE
snap Ubuntu, Debian, and other Linux distros
flatpak Multiple Linux distros (Ubuntu, Fedora, Arch, etc.)
brew macOS, Linux
chocolatey Windows
winget Windows
npm Cross-platform (Node.js packages on Windows, macOS, Linux)
pip Cross-platform (Python packages on Windows, macOS, Linux)

What version of UNIX am I running? which-os

I wrote a shell script that looks at different files to determine what OS is running. Sample output is shown below which hints that the following files will tell you info about your os:

  • /etc/os-release
  • /etc/lsb-release
  • /etc/issue
  • /etc/debian_version
  • /etc/redhat-release

Output is

which-os
Window Manager: ubuntu
Searching for MATE, GNOME, Xterm, KDE:
    mateInstalled=
    gnomeInstalled=/usr/bin/gnome-terminal
    XtermInstalled=
    KdeInstalled=
Unable to determine version of UNIX running
Enabling verbose mode.  You might be able to tell by the following output
uname -a
Linux GAWS-101-01 5.15.0-122-generic #132-Ubuntu SMP Thu Aug 29 13:45:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
==> /etc/lsb-release <==
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS"

==> /etc/os-release <==
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

------------------------------------------------------------
lsb_release
No LSB modules are available.

NOTE: uname -a is technically correct but often unhelpful. For example,

uname -a
Linux MY-HOSTNAME 5.15.0-122-generic #132-Ubuntu SMP Thu Aug 29 13:45:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Doesn’t tell me if I need to use apt, or yum.

How can I copy an image on the Linux clipboard to a file?

I used xclip and convert as follows:

xclip -selection clipboard -t image/png -o | convert png:- my-image.png

Standard Config files

mv $HOME/.bashrc       $HOME/.bashrc.orig
mv $HOME/.gitconfig    $HOME/.gitconfig.orig

# NOTE: If necessary make symlink for $HOME/myenv to point where it needs to point
# NFS_HOME=/nfs/whereever
# ln -s $NFS_HOME/myenv $HOME/myenv

ln -s $HOME/myenv/dotfiles/.bashrc-default        $HOME/.bashrc
ln -s $HOME/myenv/dotfiles/.gitconfig             $HOME
ln -s $HOME/myenv/dotfiles/.git-completion.bash   $HOME
ln -s $HOME/myenv/dotfiles/.emacs                 $HOME
ln -s $HOME/myenv/dotfiles/.vimrc                 $HOME

# Others on an as needed basis
# ln -s $NFS_HOME/.apps                           $HOME/
# ln -s $NFS_HOME/.jdks                           $HOME/
# mv $HOME/.ssh $HOME/.ssh.orig
# ln -s $NFS_HOME/.ssh                            $HOME/
 

Get rid of defaults.vim error and unreadable text

By default, I get a stupid warning whenever I start vi, the error says

hint: Waiting for your editor to close the file... E1187: Failed to source defaults.vim

The solution is to create or just touch the file ~/.exrc.
See https://stackoverflow.com/a/77422559/3281336.

Make unreadable text readable - turn off colors in vi

Every now and then I login to a system and try to use vi or vim and the text is unreadable because my background color of black makes the blue or red on black unreadable.
How can I fix this???
Add the following to your ~/.vimrc file

syntax off
set nohlsearch

My default ~/myenv/dotfiles/.vimrc file looks like this:

" Dont use smartindent anymore
" set smartindent
" Show existing tab width as 4 (not 8) chars
set tabstop=4
" When indenting with '>' use 4 spaces
set shiftwidth=4
" when pressing tab, insert spaces to next tabstop
set expandtab

" Dont show colors dark red on black is unreadable
if exists(":syntax")
    syntax off
endif
" Dont highlight searchs, I often dont want it on
set nohlsearch
" Allow me to use Ctrl-w to delete the previous word
" in addition to Ctrl-backspace
inoremap <C-H> <C-W>

<
Previous Post
How can I tell Adblock Plus that I’ve already paid?
>
Next Post
Java - Read file from classpath