CentOS terminal settings

Home

1 boot

Centos uses systemd so to specify how you want to boot, use targets

  • systemctl set-default multi-user.target sets the server to permanently boot without gui.
  • id:3:initdefault: in /etc/inittab was the older way of accomplishing the same thing
  • systemd.unit=multi-user.target added to the kernel line will give you a one-off reboot from grub into text mode.
  • rd.systemd.unit=multi-user.target or rd.systemd.unit=graphical.target on or the other?

But where do you do this?

  • Press e to edit the GRUB menu,
  • locate the line beginning with "linux16" or "linuxefi" and append "3" to that line
  • cat /proc/cmdline to see what else is in that line, before rebooting. for example
    BOOT_IMAGE=/vmlinuz-3.10.0-327.36.3.el7.x86_64 root=UUID=2cc29b16-fe2b-400f-a39f-3e9048784599 ro vconsole.keymap=us crashkernel=auto vconsole.font=latarcyrheb-sun16 rd.driver.blacklist=radeon LANG=en_US.UTF-8 3
    

    See the "3" appended to that line?

1.1 Compare /etc/grub.conf with /proc/cmdline

/etc/grub.conf lets you edit how grub will boot the system, while /proc/cmdline lets you see how grub booted the system….. I think. But

1.1.1 /etc/grub.conf not in CentOS

1.2 /etc/default/grub

That is the file to edit, which then changes /boot/efi/EFI/centos/grub.cfg Do NOT edit /boot/efi/EFI/centos/grub.cfg directly.

Here is my /etc/default/grub file:

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto resume=/dev/mapper/cl-swap rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true

But that still does not show me how to boot into text mode (non-GUI)…. hmm

This was all about the kernel (see also the command sysctl(8) in the man pages.

1.3 function keys on fusion Centos guest

To boot into a text console from a login loop in gnome, you need to have access to the function keys in your guest. To do that, you need to add vmware fusion to the apps that see the function keys, as shown in this image:

fusion-function-keys.png

Figure 1: Setting Function Keys for Fusion

2 Breaking the login loop in gnome

If you are getting the gui login window, but after entering a user and passwd are catching a glimpse of your gui, only to be bumped back to the login window, you need to read the following:

On the login window, C-M F3 should get you a console login window.

It does. But how do I start gnome again without rebooting? Probably C-M F2 or C-M F1

2.1 Virtual Console

The C-M Fn combination is actually just switching between virtual consoles:

  • C-m F1 for GDM
  • C-m F2 for console
  • C-m F1 for console (alternate?) …
  • C-m F6 for text console
  • C-m F7 for X Windows

You could possibly cycle through the virtual terminals with the M-rightarrow

You can also type sudo startx in a terminal to start the X windows system.

2.2 Possible fix to this bug

gnome has a bug related to permissions on the .Xauthority file. That should be owned by you and not root, so chown zintis:zintis .Xauthority should do it Same goes for .ICEauthority.

also /tmp should have permissions set to drwxrwxrwt (owned by root)

3 bash

alias f='open -a Finder ./' # for macbooks. gnome users change Finder app alias lst='ls -lta | head -25' alias lr='ls -R | grep ":$" | sed -e '\''s/:$//'\'' -e '\''s/[^-][^\/]*\//--g'\'' -e '\''s/^ '\'' -e '\''s-|'\'' | less'

alias myip='curl ip.appspot.com' # myip: Public facing IP Address alias netCons='lsof -i' # netCons: Show all open TCP/IP sockets alias flushDNS='dscacheutil -flushcache' # flushDNS: Flush out the DNS Cache alias lsock='sudo /usr/sbin/lsof -i -P' # lsock: Display open sockets alias lsockU='sudo /usr/sbin/lsof -nP | grep UDP' # lsockU: Display only open UDP sockets alias lsockT='sudo /usr/sbin/lsof -nP | grep TCP' # lsockT: Display only open TCP sockets alias ipInfo0='ipconfig getpacket en0' # ipInfo0: Get info on connections for en0 alias ipInfo1='ipconfig getpacket en1' # ipInfo1: Get info on connections for en1 alias openPorts='sudo lsof -i | grep LISTEN' # openPorts: All listening connections alias showBlocked='sudo ipfw list' # showBlocked: All ipfw rules inc/ blocked IPs

alias lst='ls -lartG'

alias font22='setfont LatGrkCyr-12x22.psfu.gz' alias font16='setfont LatGrkCyr-8x16.psfu.gz'

export CLICOLOR=1 export LSCOLORS=ExFxCxDxBxegedabagaced

GREEN="\[$(tput setaf 2)\]" RESET='\[$(tput sgr0)\]" export PS1="\({GREEN}\W \\\){RESET}"

4 tcsh

4.1 .cshrc

alias lst 'ls -lartG' alias ls 'ls -G' alias cd 'set old=$cwd; chdir \!* ' alias back 'set back=$old; set old=$cwd; cd $back; unset back ' setenv LSCOLORS ExFxBxDxCxegedabagacad set prompt = '%{\033[33m%}%/%{033[0j%} [%h] % ' set autocorrect set autolist

5 setup commands

cat /etc/shells cat /etc/passwd

sudo usermod –shell /usr/bin/tcsh zintis

6 Package Managers

The nice thing about standarized package managers is that there are so many to choose from.

Linux Distribtion Package Manager
Ubuntu  
Arch Linux PACMAN,
Antergas PPM
Debian DPKG (.deb)
Red Hat RPM (.rpm)
Debian APT
Ubuntuu (GUI for the
Linux Mint DPKG cli)
CentOS YUM, now DNF
Package Notes
Manager  
PACMAN  
DPKG "Debian Package Manager" has a GUI front-end
  called APT
YUM "Yellow-dog updater modified
  a fork from RPM
DNF "Dandified YUM"
  Newer rewrite of YUM using
  many fewer lines of code, and
  adding more features than YUM
GRUB This has NOTHING to do with package managers.
  - Deal with it! It is the LInux boot loader
  called the "Grand Unified Boot-loader"

7 mbp VMware Fusion library

sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli -c

Configuring Bridged network vmnet0

Configuring hostonly network vmnet1, probing for unused subnet …

Configuring NAT network vmnet8, probing for unused subnet …

See communities.vmware.com for an article on fusion network config.

8 vm1 and vm2 setup commands

sudo dnf list | grep -i bind sudo dnf list installed | grep -i bind sudo dnf install bind-utils.x8664

sudo dnf install nmap.x8664

sudo dnf install telnet.x8664 sudo dnf install net-tools.x8664

9 renameing hostname

Can use the hostnamectl command-line tool. It will change various files so that the hostname will be properly changed.

hostnamectl set-hostname CentOS8-Aragon hostnamectl –static

Without the second line, this is a transiet change? Not sure… need to try.

To change any other hostname type simply add –transient or –pretty switch. For example:

centos8

9.1 Home