C:\>cmd-line.com

"Let's learn the Command-Line Interface!"

how to ...


change superuser / root / administrator password

sudo passwd root

change the timeout in GRUB

sudo nano /etc/default/grub
GNU Linux (BASH) - Linux Mint [Debian-based distro]
  GNU nano 2.9.3                      grub                                      

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

^G Pomoc     ^O Zapisz    ^W Wyszukaj  ^K Wytnij    ^J Wyjustuj  ^C Bież.poz.
^X Wyjdź     ^R Wczyt.plik^\ Zastąp    ^U Odnów Teks^T Pisownia  ^_ Przejdź do l
  1. Change to GRUB_TIMEOUT=10 - 10 means seconds.
  2. Save the file - Ctrl + o; exit from nano - Ctrl + x
  3. Update GRUB sudo update-grub

restore GRUB after installing Windows

Issue

If we install Windows after installing Linux, we can't run Linux.

Solution

Get an ISO (CD, DVD or USB) of Linux distribution. Run Linux as "Live CD" (without installation). Then run a terminal.

GNU Linux (BASH) - Linux Mint [Debian-based distro]
mint@mint ~ $ sudo fdisk -l
Disk /dev/sda: 223,58 GiB, 240056327680 bytes, 468860015 sectors
Disk model: SanDisk SSD PLUS
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: 0x9438d1e9

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048 296962047 296960000 141,6G  7 HPFS/NTFS/exFAT
/dev/sda2       296962048 358401501  61439454  29,3G 83 Linux
/dev/sda3       358402048 464662527 106260480  50,7G 83 Linux
/dev/sda4       464662528 468858879   4196352     2G 82 Linux swap / Solaris


Disk /dev/sdb: 55,92 GiB, 60022480896 bytes, 117231408 sectors
Disk model: KINGSTON SVP200S
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: 0x781a275d

Device     Boot    Start       End  Sectors  Size Id Type
/dev/sdb1  *        2048  96751615 96749568 46,1G  7 HPFS/NTFS/exFAT
/dev/sdb2       96751616 117229567 20477952  9,8G  b W95 FAT32

GNU Linux in installed on /dev/sda2 (on /dev/sda3 there is a home partition).

sudo mount /dev/sda2 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo chroot /mnt
grub-install /dev/sda
update-grub

After executing update-grub, it may say:

Cannot find list of partitions! (Try mounting / sys.)

Let's do it!

exit (from root)
sudo mount --bind /sys /mnt/sys

Repeat previous commands

sudo chroot /mnt
grub-install /dev/sda
update-grub
GNU Linux (BASH) - Linux Mint [Debian-based distro]
mint@mint ~ $ sudo mount /dev/sda2 /mnt
mint@mint ~ $ sudo mount --bind /dev /mnt/dev
mint@mint ~ $ sudo mount --bind /proc /mnt/proc
mint@mint ~ $ sudo chroot /mnt
root@mint:/# grub-install /dev/sda
Installing for i386-pc platform.
Unknown device "/dev/sda2": No such device
(...
...
...)
Unknown device "/dev/sda2": No such device
root@mint:/# update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50_linuxmint.cfg'
Sourcing file `/etc/default/grub.d/60_mint-theme.cfg'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Unknown device "/dev/sda2": No such device
(...
...
...)
Cannot find list of partitions!  (Try mounting /sys.)
done
root@mint:/# exit
exit
mint@mint ~ $ sudo mount --bind /sys /mnt/sys
mint@mint ~ $ sudo chroot /mnt
root@mint:/# grub-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
root@mint:/# update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50_linuxmint.cfg'
Sourcing file `/etc/default/grub.d/60_mint-theme.cfg'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found theme: /boot/grub/themes/linuxmint/theme.txt
Found linux image: /boot/vmlinuz-5.4.0-58-generic
Found initrd image: /boot/initrd.img-5.4.0-58-generic
Found Windows 10 on /dev/sda1
Found Microsoft Windows XP Professional on /dev/sdb1
Found FreeDOS on /dev/sdb2
done

change the font size in CLI

Issue

In the CLI sometimes font size maybe to small or to big.

Solution
sudo dpkg-reconfigure console-setup

In the two first steps choose the default options. Next, choose font family and font size.

bulk rename files

Solution

Install rename program.

sudo apt install rename
Example
rename 's/abc/xyz/' *
rename -n 's/abc/xyz/' *

sort photos by date

Solution

Install phockup program.

bulk resize images

Solution

Install imgp program.

set system boot in CLI mode

systemctl set-default multi-user.target

To get the start back system in GUI

systemctl set-default graphical.target

hide the system menu in fullscreen games and change the resolution to the default

Issue

We can play on Linux in Windows games thanks to wine. But in the some games in full-screen mode, the system menu is visible. Additionally when we leave the game, the resolution in the system can be change to games resolution.

Solution

Make a BASH script. It will automate hiding system menu moments before start the game and set visible menu moments after leave the game.

Example for Cinnamon desktop environment (Linux Mint).

  1. Make a file
    nano script.sh
    #!/bin/bash
    gsettings set org.cinnamon panels-autohide "['1:true']"
    wine nfs.exe
    xrandr -s 1024x768
    gsettings set org.cinnamon panels-autohide "['1:false']"
    
  2. Save the file Ctrl + o & exit from nano - Ctrl + x
  3. Add execute right to this file
    chmod u+x script.sh
  4. Run the script and play the game :)
    ./script.sh
GNU Linux (BASH) - Linux Mint [Debian-based distro]
karol@core2duo:~/Aplikacje/NFS Underground$ nano script.sh
karol@core2duo:~/Aplikacje/NFS Underground$ chmod u+x script.sh
karol@core2duo:~/Aplikacje/NFS Underground$ ./script.sh