Skip to content

vi tips

Here are some uber helpful commands and startups:

In the .vimrc file, I like

  • set ai sw=4 et
  • set listchars=eol:$,tab:>-

So, this sets auto indent, the shiftwidth is 4, and “et” is expandtabs which means use spaces instead of tabs. (very handy for python and other yaml)

listchars is how you want to see characters. End of line will have a “$”, and tabs will start with > and fill with -. You can set the characters with :list. Make them invisible with :invlist

Split windows

Split windows with :split and an optional file name.

  • ^ww to change to the next window
  • :q to delete current window

checklink

checklink by w3c is by far the easiest and cheapest link checker, but is a pita to install. Here is the list:

  • Install gcc zlib-dev libssl-dev
  • cpan -i NET::SSLeay
  • cpan -i IO::Socket::SSL
  • cpan -i IO::Socket::SSL::Utils
  • cpan -i LWP::Protocol::https
  • cpan -i W3C::LinkChecker

Desktop managers

There are many desktop managers. They are installed with

sudo apt install lightdm

for instance. Here are the interesting ones:

  • lightdm
  • sddm
  • gdm3
  • slim

Switch between them with

sudo dpkg-reconfigure lightdm

Happy hunting.

KDE ubuntu and tiger, oh! my!

So, you use Ubuntu? Gnome is the default (I like gnome classic use apt install gnome-shell-extensions to enable gnome classic.)

Firstly, install kde desktop

apt install kde-desktop-standard

there are other variants of kde which have more or less kde apps loaded. For a more full KDE experience,

apt install kubuntu-desktop

If you are using the system’s keyboard and display, you should be able to choose KDE on the login screen (from the circle on the bottom right) after you select your user name.

However, if you are running headless and want to use tigerVNC to connect with KDE, then you should put the following xstartup in your ~/.vnc directory:

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
vncconfig -iconic &
dbus-launch --exit-with-session plasma_session &


Or the following:

#!/bin/sh

xrdb $HOME/.Xresources
xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
#export XKL_XMODMAP_DISABLE=1
startplasma-x11 &

 

Dumb gnome terminal

Yes, well when your gnome terminal won’t launch because “startservicebyname org.gnome.terminal” timed out, you need to (not even need to sudo) dbus-update-activation-environment –all

Yes, very stupid, I know.

In the meantime, xterm works wonderfully.

Screen cheat sheet

Screen is a Linux utility for making multiple displays with one login and switching, cutting and pasting between the sessions. Here is an abbreviated list of what to do. A full list of course is found in “man screen” or “info screen”

  • Invoke: screen
  • Detatch ^a d
  • re-attach screen -r
  • New session: ^a c
  • Next session: ^a n
  • Previous session: ^a p
  • List sessions ^a “
  • Title a window: ^a A
  • Split screen: ^a | or ^a s (vertical, horizontal)
  • Other screen (when split): ^a tab or ^a ^i
  • Unsplit screen: ^a Q
  • Copy mode: ^a [
    • in copy mode, can move the cursor with arrow keys,hjkl,
    • pg up, pg down, ^b ^f
    • Search backwards: ? or ^r
    • Search forwards: ^a s or /
    • Next / Prev search pattern: n or N
    • Mark: space
    • Copy: Enter
    • Exit: any non-copy mode key (q for one)
  • Paste: ^a ]

smb browsing

Let’s say you don’t know the connection for your “smbclient” command. Well, you would have to do some browsing. That is not the job of “smbclient”. Here are some discovery commands.

  • smbtree #show a tree of the neighborhood.
  • nmblookup -S ‘*’ #list all of the servers on all workgroups.

 

System D commands

Linux is changing to system D. The commands previously done are being replaced. Here are some of the old and new ways of doing things.

Firewall

Old way: 

iptables -I INPUT -p tcp --dport 5201 -j ACCEPT
save:
service iptables save

New way:
firewall-cmd --add-port 5201/tcp
save:
firewall-cmd --permanent --add-port 5201/tcp
Also there is --add-service servicename

Services

Old way:

service httpd stop

New way:

systemctl stop httpd

Old:

chkconfig httpd on

New:

systemctl enable httpd

Log files

Old:

less secure

New:

journalctl -u sshd

packages for Centos / Fedora

Old: yum

New: dnf

Delay in cmd scripts

Microsoft Windows does not have a delay function or application that can cause a specific delay in program execution for .cmd (and .bat) scripting. This can be overcome by pinging the localhost interface

ping -n seconds localhost > NUL:

This will delay the specified number of seconds before the script executes the next line of code.

 

Fingerprint Daemon

Who the heck uses Fingerprint Daemon, anyway?

To disable:

authconfig --disablefingerprint --update