Lists all files beginning with n or S followed by "-release".

ls [nS]*-release

Lists all files beginning with n or S followed by “-release” (e.g., novell-release)

oes11-34:/etc # ls -la [nS]*-release
-rw-r--r-- 1 root root 72 Jan 21 2014 novell-release
-rw-r--r-- 1 root root 69 Jun 3 2013 SuSE-release
oes11-34:/etc # cat [nS]*-release
Novell Open Enterprise Server 11 (x86_64)
VERSION = 11.2
SUSE Linux Enterprise Server 11 (x86_64)
oes11-34:/etc #

How to Identify Your Linux File System Type.

To identify a Linux file system you can use the following standard command:
df -T or cat /etc/fstab or mount but the commands listed below are much more cool:

Use the file command.

root# file -sL /dev/sdc1
/dev/sdc1: sticky Linux rev 1.0 ext3 filesystem data, UUID=28d01367-3886-4f67-a3c9-447bf006ae27 (needs journal recovery) (errors) (large files)

root# file -sL /dev/sdc1
/dev/sdc1: sticky Linux rev 1.0 ext3 filesystem data, UUID=28d01367-3886-4f67-a3c9-447bf006ae27 (needs journal recovery) (errors) (large files)

Use the fsck command:

root# fsck -N /dev/sdc1
fsck from util-linux 2.20.1
[/sbin/fsck.ext3 (1) -- /mnt/data] fsck.ext3 /dev/sdc1

root# fsck -N /dev/zeus/root
fsck from util-linux 2.20.1
[/sbin/fsck.ext4 (1) -- /] fsck.ext4 /dev/mapper/zeus-root

How do I shrink the root logical volume (LV) on LVM?

The root partition and LV resizing should be done on unmounted partitions, so you have to boot from a rescue CD or USB stick, run it as live CD. Then make sure, that your root LV is not installed, by


and unmount it when necessary. The LVM command vgchange changes attributes of volume groups. What needs to be “changed” to access the volume is the “availability” — i.e. to make the kernel realize the LVM volumes are there. This can be done by the command:

lvm vgchange -a y

Note, in rescue mode the system command is lvm and the LVM command that is run is vgchange. The -a y argument sets the availability to “y” or yes. As there are no specified LVM volume groups, this command will make all LVM volumes found available to the rescue kernel.

Once the kernel is aware of all LVM volumes they will be automatically mapped as devices. These are usually located under /dev/VolGroup or /dev/mapper/VolGroup (where “VolGroup” is the name of the Volume Group). Then do filesystem check

e2fsck -f /dev/yourVG/yourLV

on this LV. Then shrink filesystem

resize2fs /dev/yourVG/yourLV 5G

and reduce LV

lvreduce -L 5G /dev/yourVG/yourLV

Reboot to your system, Enjoy!

Write ISO to USB stick.

After inserting your USB stick, you can find out what device it is using the following command:

grep -Ff <(hwinfo --disk --short) <(hwinfo --usb --short)

Finally, once you've found your block device, write the image to it. Point 'dd' to the full path such as '/home/user/Downloads/Linux-x86_64.iso'

umount /dev/sdX
dd if=/path/to/downloaded.iso of=/dev/sdX

How to use bind mounts in Linux.

Bind mounting is quite simple. Instead of mounting a block device into a particular path you are mounting one path into another path.

mount -o bind /home/andzia /ftp/andzia

You will now see this reflected when running the mount command:

mount | grep var
/home/andzia on /ftp/andzia type none (rw,bind)

If you want this to persist across reboots, you’ll just need to update your /etc/fstab with the bind mount as well.

/home/andzia /ftp/andzia none bind 0 0

Get a hardware information using a CLI.

Dmidecode is a tool for dumping a computer’s DMI (some say SMBIOS) table contents in a human-readable format. This table contains a description of the system’s hardware components, as well as other useful pieces of information such as serial numbers and BIOS revision. Thanks to this table, you can retrieve this information without having to probe for the actual hardware. While this is a good point in terms of report speed and safe‐ness, this also makes the presented information possibly unreliable.

dmidecode |grep -i product

Recover root password.

1. Boot the LiveCD or rescue CD/USB, and mount your root (/) partition. For example:

mkdir /mnt/root
mount /dev/sdaX /mnt/root

and then edit the password file with your editor:

vim /mnt/root/etc/shadow

and then delete the second field on the root line:


2. Boot the LiveCD or rescue CD/USB, and mount your root (/) partition. For example:

mount -o remount,rw /dev/sdaX /mnt/root
chroot /mnt/root
passwd root

3. INIT or /bin/bash mode

Another trick is to add “init=/bin/bash” (LILO “linux init=/bin/bash” or add it to the Grub “kernel” line). This will dump you to a bash prompt much earlier than single user mode, and a lot less has been initialised, mounted, etc. You’ll definitely need the “-o remount,rw” here. Also note that other filesystems aren’t mounted at all, so you may need to mount them manually if you need them. Look in /etc/fstab for the device names.

passwd root


How to install and set up VPN (PPTP) server on Debian Linux.

PoPToP Point to Point Tunneling Server, this implements a Virtual Private Networking Server (VPN) that is compatible with Microsoft VPN clients. It allows windows users to connect to an internal firewalled network using their dialup.

Install pptpd:

root:# apt-get install pptpd

and then edit the configuration file:

root:# vim /etc/pptpd.conf

and add the following lines to:


# Specifies the local and remote IP address ranges.
# Any addresses work as long as the local machine takes care of the
# routing. But if you want to use MS-Windows networking, you should
# use IP addresses out of the LAN address space and use the proxyarp
# option in the pppd options file, or run bcrelay.

then edit the configuration file:

root:# vim /etc/ppp/pptpd-options

and add the following lines to:

ms-dns # my DNS server
mtu 1490
mru 1490

edit another one configuration file:

root:# vim /etc/ppp/chap-secrets

and add the following lines to:

username * password *

then restart the pptpd service:

root@server: service pptpd restart

and don’t forget to enable 1723 on a firewall.

TightVNC Remote Desktop Connections using SUSE as Client or Server.

1. Install the tightvnc and xorg-x11-Xvnc packages:

root# zypper install tightvnc xorg-x11-Xvnc

Type the command vncserver to start the VNC server, and then type the command
vi $HOME/.vnc/xstartup
to open the VNC configuration file in the vi text editor. You can replace “vi” with your preferred text editor.
Add the line /usr/bin/gnome & under the #!/bin/sh line, if you are using the Gnome desktop.

Type the command vncserver in Suse 10 or dbus-launch vncserver in Suse 11, to start the VNC server. Take note of the desktop number, usually “:1,” “:2” or “:3,” that is shown after the command is executed.

2. Connect to the Server

Open the VNC viewer software on the remote computer. Type “” in the connection text box. Replace “” with the IP address of the Suse server. Replace “:1” with the desktop number from the previous section. and then type the password for the VNC server, when prompted.

Users who are logged on can start a server with a simple console command.

• Starting the server in Suse versions 10.x: vncserver
• Starting the server in Suse versions 11.x: dbus-launch vncserver

The vncserver command will start the next unused desktop in the sequence :1, :2, :3 …etc. You can attach many options to the command line when starting the server. There are options specific to TightVNC on the TightVNC man page and you can also attach the options listed in the Xvnc man page.

Note: vncpasswd allows you to set the password used to access VNC desktops. Its default behavior is to prompt for a VNC password and then store an obfuscated version of this password to passwd-file (or to $HOME/.vnc/passwd if no password file is specified.) The vncserver script runs vncpasswd the first time you start a VNC desktop, and it invokes Xvnc with the appropriate -rfbauth option. vncviewer can also be given a password file to use via the -passwd option. The password must be at least six characters long (unless the -f command-line option is used– see below), and only the first eight characters are significant. Note that the stored password is not encrypted securely – anyone who has access to this file can trivially find out the plain-text password, so vncpasswd always sets appropriate permissions (read and write only by the owner.) However, when accessing a VNC desktop, a challenge-response mechanism is used over the wire making it hard for anyone to crack the password simply by snooping on the network.

conf example:

server:/home/user/.vnc # cat xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &