Skip to content

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 ALLOW
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

IP address alias

A NIC can have multiple IP addresses and this is easiest to do with ifconfig.

ifconfig eth0:0 10.0.0.12 netmask 255.255.0.0

To delete the alias:

ifconfig eth0:0 down

Compiling glib-2.34.3 on Mac OSX

I loaded the development app on the mac.

I tried to configure glib-2.34.3, but it required gettext. So, I got gettext. The only problem I has was the file stpncpy.c had a weak_alias macro that allowed stpncpy.c to declare a function. However, since Mac already had that function, there was a problem. I had to define weak_alias in that file:

#define weak_alias(a,b) /* */

Of course, the right way to do this would be to check if stpncpy.c is defined. The test failed on bash. Everything else passed.

On to the build of glib2.

I had to define export LIBFFI_LIBS=-lffi and export LIBFFI-CFLAGS=-I/usr/include/ffi

Then, config did not put these values into the make file so I had to invoke make with “-e” option.

The package I wanted to compile needed pkg-config, so I went to http://www.freedesktop.org/wiki/Software/pkg-config to get it. I needed to put in the variables from /usr/local/lib/pkgconfig/glib-2.0.pc from Libs: and Cflags: as
GLIB_LIBS="-L/usr/local/lib -lglib-2.0 -lintl"
GLIB_CFLAGS="-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include"