Linux screen lock command line : xl: The simple X11 lock

When using command line linux sometimes we need to lock screen, it very useful when you need to leave your PC for a while and keep them online. After searching in many forum and google for this, i’ve found a very effective and useful custom lock screen linux application called “xl”, according into :

xscreensaver, xlock, xlockmore, all of them, completley useless. They have overflows, they have buggy drawning routines, they are very prone to crashing. The more complex they get, the more useless they are. If a screen locking program decides to crash on me, its not doing a very good job of keeping my terminal locked. I’ve had many people just go to my screen and hit tons of keys just to make it crash, or cycling the screen saver to get to a certain one known to crash. Absolutly ridiculous!

This is my solution to the problem. Very simple, very small, very few features. Doesn’t even blank your screen, all this program does is lock your keyboard and mouse, and only unlocks it if you type your login password and hit return.

You can also override the password by specifying it as the first argument of the command line. A third way is to set the XLPASSWD environment variable.

But it need your knowledge how to compile and execute linux programs in simple ways.

Source code :


Creating a bootable Ubuntu USB flash drive from terminal

  • Place the ubuntu.iso file in any hard disk partition.
  • Then mount the ubuntu.iso file with the below commands in terminal:
sudo mkdir /media/iso/
sudo mount -o loop /path/to/ubuntu.iso /media/iso
  • Insert your USB flash drive. My drive is /dev/sdb, in other case it maybe /dev/sdd.
  • Your drive may be automatically mounted inside /media/. Let’s assume that it was mounted in /media/xxx/.
  • Copy all files from /media/iso/ to your mounted USB flash drive by running the below command (make sure to include the dot):
cp -a /media/iso/. /media/xxx/
  • Next, you need the ldlinux.sys file in your USB flash drive to make the USB bootable. My USB partition is /dev/sdb1; enter lsblk to see what’s yours. Run the below commands:
sudo apt-get install syslinux mtools
sudo syslinux -s /dev/sdd1
  • Navigate to the /media/xxx mount folder and rename the isolinux directory to syslinux. Then go into the renamed folder and rename the file isolinux.cfg to syslinux.cfg.
  • Reboot your PC and change the boot order in BIOS to allow booting from a USB drive. Now your Ubuntu USB flash drive will boot and you can install it.

This method will work for any Linux distribution, not only Ubuntu. You don’t need to install any third party software to make a Linux USB flash drive.

Source :