Archive for the ‘Debian-Testing’ Category:

How to change user information such as full name from the command prompt.

To change the full name and other information stored for a certain user, the chfn command will come in handy. This allows a system administrator to change the data with a simple command.

In this example, I am changing the full name for a Linux user.

[email protected]:~# chfn -f "Praise kek" jason

Now I use the finger command to view the information as I am already logged in as this user.

[email protected]:~# finger -lmps
Login: jason          			Name: Praise kek
Directory: /home/jason              	Shell: /bin/bash
On since Tue Nov 15 07:59 (AEDT) on tty7 from :0
On since Tue Nov 15 08:33 (AEDT) on pts/0 from :0
   1 minute 33 seconds idle
On since Tue Nov 15 08:44 (AEDT) on pts/2 from :0
   4 seconds idle
     (messages off)
No mail.

That is how easy this is. Below is some information regarding the other things that may be edited by this command.

The options which apply to the chfn command are:

       -f, --full-name FULL_NAME
           Change the user's full name.

       -h, --home-phone HOME_PHONE
           Change the user's home phone number.

       -o, --other OTHER
           Change the user's other GECOS information. This field is used to store accounting information used by other applications, and can be changed only by a superuser.

       -r, --room ROOM_NUMBER
           Change the user's room number.

       -R, --root CHROOT_DIR
           Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory.

       -u, --help
           Display help message and exit.

       -w, --work-phone WORK_PHONE
           Change the user's office phone number.

       If none of the options are selected, chfn operates in an interactive fashion, prompting the user with the current values for all of the fields. Enter the new value to
       change the field, or leave the line blank to use the current value. The current value is displayed between a pair of [ ] marks. Without options, chfn prompts for the
       current user account.

The usermod command is another way to accomplish this, use this command to change the full name.

[email protected]:~# usermod -c "John Snow" jason

This is also very effective.

[email protected]:~# finger -lmps
Login: jason          			Name: John Snow
Directory: /home/jason              	Shell: /bin/bash
On since Tue Nov 15 07:59 (AEDT) on tty7 from :0
On since Tue Nov 15 08:33 (AEDT) on pts/0 from :0
   32 minutes 25 seconds idle
On since Tue Nov 15 08:44 (AEDT) on pts/2 from :0
   1 second idle
     (messages off)
No mail.

This way, user information may be easily edited. This makes it easy to change user information with a simple command.

Another way is to edit the /etc/passwd file in VIM to change the user`s details.

Editing the /etc/passwd files in VIM.

Editing the /etc/passwd files in VIM.

Gorgeous Linux themes for the modern desktop.

Gnome Shell themes

Tron Legacy Gnome Shell theme.

http://www.linuxnov.com/tron-legacy-theme-for-gnome-shell/. This is a Gnome Shell theme inspired by the Tron Legacy movie.

MetalX Gnome Shell theme for Linux.

https://www.deviantart.com/art/Metal-X-theme-v-2-1-for-Gnome-3-16-577064989.

Android Flat Gnome Shell theme. A nice flat grey theme for your Gnome desktop.

https://www.deviantart.com/art/Android-Flat-3-18-565622252.

Ambiance Gnome.

https://www.deviantart.com/art/Ambiance-Gnome-3-14-1-8-GNOME-Shell-theme-476996106.

An Ubuntu inspired theme for any Gnome Shell desktop. Make your Gnome Shell desktop look like Ubuntu Unity.

Elegance-Elemantary-Faience-Axiom Gnome Shell 3.6.

https://www.deviantart.com/art/Elegance-Elemantary-Faience-Axiom-Gnome-Shell-3-6-335120156.

Gorgeous Gnome Shell theme.

Wallpapers

Chernobyl Ferris wheel wallpaper.

https://4walled.cc/show-1393258.

Chernobyl town wallpaper.

https://4walled.cc/show-1235898.

Chernobyl reactor photograph.

https://4walled.cc/show-1199008.

Old disused bumper car photograph.

https://4walled.cc/show-551097.

Post-Apocalyptic Fallout wallpaper.

https://4walled.cc/show-575446.

Flooded Golden Gate Bridge.

https://4walled.cc/show-263115.

Flooded London wallpaper.

https://4walled.cc/show-6312.

Some kind of industrial machine belching black smoke.

https://4walled.cc/show-305722.

Landscape Wallpapers (HD), Some of my Favorites

Wallpaper Collection

Icon themes

Faience icon theme set.

http://tiheum.deviantart.com/art/Faience-icon-theme-255099649.

Papirus Icon Theme

http://www.omgubuntu.co.uk/2016/08/best-linux-icon-theme-papirus-supports-more-apps.

The Papirus icon theme, which is derived from Sam Hewitt’s Paper theme, already supports hundreds of well known apps, including all the usual faves like Firefox, Thunderbird, Corebird, GIMP and Geary.

How to build a 4.8.4 Linux kernel on Ubuntu 16.10.

To build the latest 4.8.4 Linux kernel on Ubuntu 16.10, you will only need the ncurses-dev and build-essential packages installed. Then we are ready to install a new Linux kernel.

Download the latest Linux kernel tarball.

jason$ wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.8.4.tar.xz

And then unpack the Linux tarball that we have downloaded.

jason$ tar -xvf linux-4.8.4.tar.xz

Now to check the Linux source tree is free of unwanted cruft.

jason$ cd linux-4.8.4/
 
jason$ make mrproper

Now I copy the existing configuration from the running kernel to the source tree.

jason$ cp /boot/config-4.4.0-45-generic .config

Now run make menuconfig to configure the new Linux kernel.

Kernel 4.8.4 configuration.

Kernel 4.8.4 configuration.

jason$ make menuconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/mconf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTLD  scripts/kconfig/mconf
scripts/kconfig/mconf  Kconfig
.config:1631:warning: symbol value 'm' invalid for RXKAD
.config:3589:warning: symbol value 'm' invalid for SERIAL_8250_FINTEK
.config:7537:warning: symbol value 'm' invalid for EXT4_ENCRYPTION
configuration written to .config
 
*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

Now start the compilation. This could take quite a while, depending upon the options chosen during the configuration phase.

jason$ make && make modules

Then, once the long compilation process has completed successfully, install the modules first.

jason$ sudo make modules_install
[sudo] password for jason:

Then install the actual kernel image and related files to /boot.

jason$ sudo make install
sh ./arch/x86/boot/install.sh 4.8.4 arch/x86/boot/bzImage \
	System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.8.4 /boot/vmlinuz-4.8.4
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.8.4 /boot/vmlinuz-4.8.4
update-initramfs: Generating /boot/initrd.img-4.8.4
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.8.4 /boot/vmlinuz-4.8.4
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.8.4 /boot/vmlinuz-4.8.4
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.8.4 /boot/vmlinuz-4.8.4
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.8.4 /boot/vmlinuz-4.8.4
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.8.4
Found initrd image: /boot/initrd.img-4.8.4
Found linux image: /boot/vmlinuz-4.4.0-45-generic
Found initrd image: /boot/initrd.img-4.4.0-45-generic
Found linux image: /boot/vmlinuz-4.4.0-43-generic
Found initrd image: /boot/initrd.img-4.4.0-43-generic
Found linux image: /boot/vmlinuz-4.4.0-42-generic
Found initrd image: /boot/initrd.img-4.4.0-42-generic
Found linux image: /boot/vmlinuz-4.4.0-38-generic
Found initrd image: /boot/initrd.img-4.4.0-38-generic
Found linux image: /boot/vmlinuz-4.4.0-36-generic
Found initrd image: /boot/initrd.img-4.4.0-36-generic
Found linux image: /boot/vmlinuz-4.3.3-gnu
Found initrd image: /boot/initrd.img-4.3.3-gnu
Found linux image: /boot/vmlinuz-4.3.0-6-lowlatency
Found initrd image: /boot/initrd.img-4.3.0-6-lowlatency
Found linux image: /boot/vmlinuz-4.3.0-6-generic
Found initrd image: /boot/initrd.img-4.3.0-6-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
done

Then clean and prepare the source tree to put it in /usr/src.

jason$ sudo make clean prepare
  CLEAN   .
  CLEAN   arch/x86/entry/vdso
  CLEAN   arch/x86/kernel/cpu
  CLEAN   arch/x86/kernel
  CLEAN   arch/x86/purgatory
  CLEAN   arch/x86/realmode/rm
  CLEAN   arch/x86/lib
  CLEAN   certs
  CLEAN   crypto/asymmetric_keys
  CLEAN   crypto
  CLEAN   drivers/firmware/efi/libstub
  CLEAN   drivers/gpu/drm/radeon
  CLEAN   drivers/net/wan
  CLEAN   drivers/scsi/aic7xxx
  CLEAN   drivers/tty/vt
  CLEAN   firmware
  CLEAN   kernel/debug/kdb
  CLEAN   lib/raid6
  CLEAN   lib
  CLEAN   security/apparmor
  CLEAN   security/selinux
  CLEAN   security/tomoyo
  CLEAN   usr
  CLEAN   arch/x86/boot/compressed
  CLEAN   arch/x86/boot
  CLEAN   arch/x86/tools
  CLEAN   .tmp_versions
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/bin2c
  HOSTCC  arch/x86/tools/relocs_32.o
  HOSTCC  arch/x86/tools/relocs_64.o
  HOSTCC  arch/x86/tools/relocs_common.o
  HOSTLD  arch/x86/tools/relocs
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      arch/x86/purgatory/purgatory.o
  AS      arch/x86/purgatory/stack.o
  AS      arch/x86/purgatory/setup-x86_64.o
  CC      arch/x86/purgatory/sha256.o
  AS      arch/x86/purgatory/entry64.o
  CC      arch/x86/purgatory/string.o
  LD      arch/x86/purgatory/purgatory.ro
  BIN2C   arch/x86/purgatory/kexec-purgatory.c
  CHK     include/generated/timeconst.h
  CC      kernel/bounds.s
  CHK     include/generated/bounds.h
  GEN     scripts/gdb/linux/constants.py
  CC      arch/x86/kernel/asm-offsets.s
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh

Now, after moving the source tree to /usr/src, we must update the symlinks under /lib/modules/4.8.4/ to reflect the new location of the Linux source.

jason$ ls -hula /lib/modules/4.8.4/
total 4.4M
drwxr-xr-x  3 root root 4.0K Oct 27 12:01 .
drwxr-xr-x  8 root root 4.0K Oct 27 12:00 ..
lrwxrwxrwx  1 root root   20 Oct 27 12:00 build -> /usr/src/linux-4.8.4
drwxr-xr-x 12 root root 4.0K Oct 27 11:47 kernel
-rw-r--r--  1 root root 1.1M Oct 27 11:47 modules.alias
-rw-r--r--  1 root root 1.1M Oct 27 11:48 modules.alias.bin
-rw-r--r--  1 root root 7.0K Oct 27 11:47 modules.builtin
-rw-r--r--  1 root root 8.8K Oct 27 11:48 modules.builtin.bin
-rw-r--r--  1 root root 459K Oct 27 11:47 modules.dep
-rw-r--r--  1 root root 658K Oct 27 11:48 modules.dep.bin
-rw-r--r--  1 root root  285 Oct 27 11:47 modules.devname
-rw-r--r--  1 root root 176K Oct 27 11:47 modules.order
-rw-r--r--  1 root root  114 Oct 27 11:48 modules.softdep
-rw-r--r--  1 root root 440K Oct 27 11:47 modules.symbols
-rw-r--r--  1 root root 545K Oct 27 11:48 modules.symbols.bin
lrwxrwxrwx  1 root root   20 Oct 27 12:01 source -> /usr/src/linux-4.8.4

This way, we will be able to compile drivers against the Linux kernel when it is running.

Now our new 4.8.4 Linux kernel is installed and the machine is ready to reboot into the newly installed kernel. That was not too hard after all.

How to change the Ubuntu hostname easily.

To change the hostname of an Ubuntu machine, there are a couple of files that need editing. Firstly, open the /etc/hostname file and change the hostname in here to the one you wish to use.

09:51:17 0 ~
jason$ sudo vim /etc/hostname

Then edit the /etc/hosts file and change the hostname in there to match.

09:51:17 0 ~
jason$ sudo vim /etc/hosts

Now run this command to set the new hostname until you restart.

09:51:17 0 ~
jason$ sudo hostname darkstar

You do not need to reboot to set a new hostname, this is the proper way to do it, Linux is not as reliant upon re-boots as Windows.

Now I open another terminal and query the hostname and I see my new one there.

09:49:18 0 ~
jason$ hostname
darkstar

That is how easy it is to set a new hostname on Linux, this is very useful when customizing your Linux installation.

How to get wireless network information in Windows 7 with CMD.

Getting wireless network information from Windows 7 is easy with CMD and netsh. This post will show how easy this is without admin access.

Listing all visible wireless networks on the machine with netsh.

C:\Users\Corporal Kerry>netsh wlan show profile
 
Profiles on interface Wireless Network Connection:
 
Group policy profiles (read only)
---------------------------------
    <None>
 
User profiles
-------------
    All User Profile     : OPTUSVD3AEDEA
    All User Profile     : HP-Print-1D-Photosmart 5520
    All User Profile     : Optus234545
    All User Profile     : ISIL
    All User Profile     : GTLHOME

Getting information about on particular wireless network.

C:\Users\Corporal Kerry>netsh wlan show profile name="OPTUSVD3AEDEA" key=clear
 
Profile OPTUSVD3AEDEA on interface Wireless Network Connection:
=======================================================================
 
Applied: All User Profile
 
Profile information
-------------------
    Version                : 1
    Type                   : Wireless LAN
    Name                   : OPTUSVD3AEDEA
    Control options        :
        Connection mode    : Connect automatically
        Network broadcast  : Connect only if this network is broadcasting
        AutoSwitch         : Do not switch to other networks
 
Connectivity settings
---------------------
    Number of SSIDs        : 1
    SSID name              : "OPTUSVD3AEDEA"
    Network type           : Infrastructure
    Radio type             : [ Any Radio Type ]
    Vendor extension          : Not present
 
Security settings
-----------------
    Authentication         : WPA2-Personal
    Cipher                 : CCMP
    Security key           : Present

To get the password of the wireless network, run CMD as admin and enter the same command.

C:\Windows\system32>netsh wlan show profile name="GTLHOME" key="clear"
 
Profile GTLHOME on interface Wireless Network Connection:
=======================================================================
 
Applied: All User Profile
 
Profile information
-------------------
    Version                : 1
    Type                   : Wireless LAN
    Name                   : GTLHOME
    Control options        :
        Connection mode    : Connect automatically
        Network broadcast  : Connect only if this network is broadcasting
        AutoSwitch         : Do not switch to other networks
 
Connectivity settings
---------------------
    Number of SSIDs        : 1
    SSID name              : "GTLHOME"
    Network type           : Infrastructure
    Radio type             : [ Any Radio Type ]
    Vendor extension          : Not present
 
Security settings
-----------------
    Authentication         : WPA2-Personal
    Cipher                 : CCMP
    Security key           : Present
    Key Content            : samthedog

This is how to get useful information about wireless networks and print the stored password in case you forget it.

How to get information about your filesystems with the Linux command line.

The Linux command line allows a user to get good information about filesystems using the shell prompt. Here are some examples.

Print a list of all filesystems and their sizes in megabytes.

ubuntu ~ $ df -Hla -BMB
Filesystem     1MB-blocks    Used Available Use% Mounted on
sysfs                 0MB     0MB       0MB    - /sys
proc                  0MB     0MB       0MB    - /proc
udev                516MB     1MB     516MB   1% /dev
devpts                0MB     0MB       0MB    - /dev/pts
tmpfs               105MB     1MB     104MB   1% /run
/dev/xvda1        31563MB 25670MB    4504MB  86% /
none                  1MB     0MB       1MB   0% /sys/fs/cgroup
none                  0MB     0MB       0MB    - /sys/fs/fuse/connections
none                  0MB     0MB       0MB    - /sys/kernel/debug
none                  0MB     0MB       0MB    - /sys/kernel/security
none                  6MB     0MB       6MB   0% /run/lock
none                521MB     0MB     521MB   0% /run/shm
none                105MB     0MB     105MB   0% /run/user
none                  0MB     0MB       0MB    - /sys/fs/pstore
systemd               0MB     0MB       0MB    - /sys/fs/cgroup/systemd

List all block devices in your Linux machine and their mountpoint.

ubuntu ~ $ lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  30G  0 disk
└─xvda1 202:1    0  30G  0 part /

The parted utility allows a superuser to list all filesystems in a Linux system.

Just run sudo parted and then the print all command.

sudo parted
GNU Parted 2.3
Using /dev/xvda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print all
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 32.2GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
 
Number  Start   End     Size    Type     File system  Flags
 1      8225kB  32.2GB  32.2GB  primary  ext4         boot
 
 
(parted)

The fdisk command will also list all filesystems.

ubuntu ~ $ sudo fdisk -l
 
Disk /dev/xvda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
 
    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *       16065    62910539    31447237+  83  Linux

Sfdisk is a good alternative, this will display partition sizes in megabytes.

ubuntu ~ $ sudo sfdisk -l -uM
 
Disk /dev/xvda: 3916 cylinders, 255 heads, 63 sectors/track
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0
 
   Device Boot Start   End    MiB    #blocks   Id  System
/dev/xvda1   *     7+ 30718- 30711-  31447237+  83  Linux
/dev/xvda2         0      -      0          0    0  Empty
/dev/xvda3         0      -      0          0    0  Empty
/dev/xvda4         0      -      0          0    0  Empty

There is also a Python script, pydf, this will list all partitions on your hard drive.

Firstly, install this script.

sudo apt-get install pydf

Then run this script to get an idea of how much space is left on your filesystems.

ubuntu ~ $ pydf
Filesystem Size Used Avail Use%                                  Mounted on
/dev/xvda1  29G  24G 4294M 81.3 [########################......] /\

To get the UUID of a Linux filesystem, run this command and get the UUID that matches the name, such as /dev/sda1.

ubuntu ~ $ blkid
/dev/xvda1: LABEL="cloudimg-rootfs" UUID="ee515a1e-7735-4529-822f-4cc9e7632cd3" TYPE="ext4"

The output of the pydf script is the best, using a simple graph to show how much disk space is taken up. This means that it is the quickest to interpret. The output of the df -Hla -BMB command can be the hardest to interpret as it outputs so much, but I will leave it up to you which you choose to use. Linux has so many options right now it can be quite overwhelming. Just choose the option that suits you.

Some very useful bash shell tips.

The bash shell has some very useful features when using the command line. This can make using the command line much faster. For example, if you forget to type sudo before a command, this can be fixed this way.

jason$ fdisk -l /dev/sda
fdisk: cannot open /dev/sda: Permission denied

Type sudo !! at the command line.

jason$ sudo !!
sudo fdisk -l /dev/sda
[sudo] password for jason: 
Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000658b4
 
Device     Boot  Start        End    Sectors  Size Id Type
/dev/sda1  *      2048     206847     204800  100M  7 HPFS/NTFS/exFAT
/dev/sda2       206848 3907026943 3906820096  1.8T  7 HPFS/NTFS/exFAT

And the command will be redone with the sudo command prepended to it.

Press ^p to retype the last command at the bash shell prompt. If you have already typed something at the prompt, it will be replaced.

^l will clear the terminal window.

^a will take the cursor back to the start of the command line.

Press ^w to erase back one word on the command line. Use this multiple times to erase a whole sentence.

Print information about your tty terminal interface like this.

Printing information about the terminal.

Printing information about the terminal.

To erase an entire line, run this command.

jason$ stty kill ^a

Now ^a will erase an entire line at the bash prompt. Put this into the .bashrc and this will be available whenever you need it.

More bash shortcuts information here.

Have fun!

50,000 dollar hard disk drive being loaded onto a truck.

50,000 dollar hard disk drive being loaded onto a truck.

How to search the apt packages list for a certain package.

The apt command allows the user to search for a specific package. This is very useful if you do not know the exact name for package installation.

This is one way.

ubuntu ~ $ apt-cache search vim

This will return a long listing of all matching package names.

This is another way. This will return a listing of all matching packages with a short one sentence description.

ubuntu ~ $ apt search vim

This is how to filter the output to get better results. Here I am looking for all VIM editor packages.

ubuntu ~ $ apt-cache search vim | grep editor
vim - Vi IMproved - enhanced vi editor
vim-dbg - Vi IMproved - enhanced vi editor (debugging symbols)
vim-gnome - Vi IMproved - enhanced vi editor - with GNOME2 GUI
vim-tiny - Vi IMproved - enhanced vi editor - compact version
editmoin - edit MoinMoin wiki pages with your favourite editor
elvis-tiny - Tiny vi compatible editor for the base system
vim-addon-manager - manager of addons for the Vim editor
vim-athena - Vi IMproved - enhanced vi editor - with Athena GUI
vim-gtk - Vi IMproved - enhanced vi editor - with GTK2 GUI
vim-lesstif - Vi IMproved - enhanced vi editor (transitional package)
vim-nox - Vi IMproved - enhanced vi editor - with scripting languages support
vim-vimoutliner - script for building an outline editor on top of Vim

Very easy to do.

Another example.

Results of apt cache search.

Results of apt cache search.

This is a very good thing to know when you are stuck with a package that you cannot remember the name of.

Send a message to logged in Linux users and other nice tricks.

To send a message to logged in Linux users with the wall command, just open it and type a message. Then press ^D to send it.

jason$ wall
Hi
 
Broadcast message from jason@jason-desktop (pts/0) (Sat Aug 27 22:24:05 2016): 
 
Hi

This is useful for messaging users about an upcoming server restart or maintenance.

If the user was not using a terminal window or a VT, they would not see the message, so use this instead. Xmessage will pop up a message on the user`s desktop. That way they will get the message.

22:28:23 0 ~
jason$ export DISPLAY=':0.0'
 
22:29:00 0 ~
jason$ xmessage "Server restart in 10 min."

This is what it looks like.

Xmessage displaying a message from a server admin.

Xmessage displaying a message from a server admin.

Another way is using the write command. This requires the user to give it the username and the TTY the user is logged into. This is only useful if you actually know that a user is on a terminal or TTY and which one.

09:57:59 1 ~
jason$ write jason /dev/pts/0
 
Message from jason@jason-desktop on pts/0 at 09:58 ...
Hello
Hello
EOF

If I try to message a terminal with noone on it I get this error..

09:58:14 0 ~
jason$ write jason /dev/tty2
write: jason is not logged in on tty2

But this is still useful. The wall or warn all command is the best for messaging users that are in terminals, and the xmessage command for messaging users in a desktop environment. Good ways to warn users of upgrades or server maintenance.

Australian Census website goes down under the strain.

I hate Windows 10.

I hate Windows 10.

The Australian Census website went down under the strain of usage and the government is blaming foreign cyber-attackers for the problems when it is to do with the inability to deal with the amount of traffic that came to the website on the census night. Of course, I did mine in advance and had zero problems, but the other people that tried to do their census on the night have had huge problems. This is why the server should have been load tested before the night, this would have revealed problems with the bandwidth and load capacity of the web server. There are tools available to load-test servers before they are needed for a major requirement such as a census night. That would have not required much effort at all, but this is the Australian government we are talking about here. Apparently, they are now saying this was not an on-line attack after all, but what a bungle it is. That is why websites that are intended for a heavy load should be distributed to handle the load. Blaming “overseas attackers” for your own IT failings is not the best way to handle this situation.

OCP facepalm.

OCP facepalm.

Building better IT infrastructure for Australia should be a goal for the 21st century, but this has fallen by the wayside. Our Internet infrastructure lags behind many other countries and we are selling everything off to foreign buyers. Independent Senator Nick Xenophon, who last week called for the Census to be delayed because of growing concerns about its roll-out, security and the readiness of the ABS, said the census was “a monumental failure of a government program of the first order’’. “In response to my calls for a delay the Government and the ABS were dismissive of my concerns. They said everything was OK,’’ he said. This is a huge embarrassment for the Australian government. I wonder what will happen if they want to move the Election voting on-line… It would be fun to watch that is for sure. Malcolm Turnbull sought to assure Australians their census data was “safe” and had not been “compromised” but admitted that some of the Australian Bureau of Statistics “defenses” had clearly “failed” last night. He said the ABS’ decision to close down the census on-line site was “taken out of an abundance of caution”. So the website was shut down due to overload, but it should have been able to handle the expected load, but it could not. This is a failure in planning, they should have known what load the server was expected to take. They should learn their lesson from this and do a better job next time.

Funny Linux photograph, this is in a supermarket.

Linux filesystem error in a supermarket.

Linux filesystem error in a supermarket.

This is a photograph captured in a supermarket. This shows a Linux machine that must be meant for showing advertisements or other videos and it is instead depicting a Linux bootup error. The filesystem has an inconsistency and this means that the fsck utility must be run manually to fix the error. Not a major issue as long as the drive is not failing. If it is a magnetic drive, this means that you hear a click of death, this means back up all data and replace it right away. But this machine is running Gentoo Linux, I have had a lot of issues with that distribution. Better to run Fedora in a business environment. Although Ubuntu Server is very good.

Below is another picture, an ATM running Windows 7. This machine is asking for Windows activation. Please just enter the product key…

Windows 7 activation on an ATM machine.

Windows 7 activation on an ATM machine.

Linux Terminal command to format PGP to properly display on reddit.

So it was brought to my attention that a command in Linux exist that makes what I made obsolete. Here is the code you can run in the terminal. Simply save your PGP message, name it something, and place it on your Desktop and replace FILENAME with the name of the file you saved the PGP message as.

cat ~/Desktop/FILENAME | sed 's|^|    |g'

then it will print the formatted message into the terminal, highlight it and right click and click “copy” ctrl+c does not copy inside terminal.

How to block access to the .htaccess file on an Apache web server.

Blocking access to the .htaccess file on your Apache web server blocks access to the file by curious web users that want to see what directives are in it. The code below added to the .htaccess file will forbid all access to the .htaccess file by web users while still allowing it to function.

#Deny attempts to view the Htaccess file.
<Files .htaccess>
Order allow,deny
Deny from all
</Files>

Very important to add this code when setting up your web server.

Count the actual lines of code in your C or C++ project.

This is how to actually count the lines of code in your C project on Linux. Some people advocate using wc -l, but that would not suit our purposes. The cloc utility is able to do this and more.

Firstly, install this utility.

sudo apt install cloc

Then run the utility in a source folder.

jason@jason-desktop:~/Documents/ipinfo/src$ cloc .
       2 text files.
       2 unique files.                              
       0 files ignored.
 
http://cloc.sourceforge.net v 1.60  T=0.01 s (138.5 files/s, 11358.2 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C/C++ Header                     1             13             10             66
C                                1             14              8             53
-------------------------------------------------------------------------------
SUM:                             2             27             18            119
-------------------------------------------------------------------------------

This utility shows the number of files, the lines of actual code, and the comments. Very useful for keeping track of how big your project is. It also shows a summary row with the totals at the bottom.

Use the –strip-comments=.strip parameter to write copies of the files with all comments and blank lines edited out.

jason@jason-desktop:~/Documents/ipinfo/src$ cloc . --strip-comments=.strip
       2 text files.
       2 unique files.                              
Wrote info.h..strip
Wrote ip.c..strip
       0 files ignored.
 
http://cloc.sourceforge.net v 1.60  T=0.01 s (286.3 files/s, 22190.6 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                                1              0              0             66
C/C++ Header                     1             13             10             66
-------------------------------------------------------------------------------
SUM:                             2             13             10            132
-------------------------------------------------------------------------------

Very useful for making a simplified C source file, but having comments in the file is very useful when someone else has to take on your code.

How to login as root on Ubuntu 16.04.

To login as root on Ubuntu 16.04, open the terminal and type this command.

[email protected]:~$ sudo su -
[sudo] password for jason: 
[email protected]:~#

This will give you a root prompt. Then enter this command to unlock the root account.

[email protected]:~# passwd root
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

This allows the user to set a password for the root user and unlock the account. A very useful tip to make full use of your machine.

Now it works.

[email protected]:~$ su
Password: 
root@jason-desktop:/home/jason#

Linux commands cheat sheet.

Linux commands cheat sheet.

With this list of basic Linux commands and sample usages, you’ll never have to worry about forgotten commands again. The items contained within brackets are optional, and type man at a shell for more information.

Ubuntu pocket guide.

Ubuntu Pocket Guide and Reference (PDF Edition)

Linux Mint users guide. Very useful for all Linux Mint fans.

Linux Mint users guide. Very useful for all Linux Mint fans.

The Debian Administrator’s Handbook.

The Debian Administrator’s Handbook.

Linux Fundamentals.

Linux Fundamentals ebook.